I have the following HTML
<embed class='pdf_container' src='welcome.pdf' style ='width:100%;height:500px;' ></embed>
<div id="show_message" class='message_wrapper' >
<div id="message_content"> The requested operation ... </div>
</div>
and in CSS
.message_wrapper{
position:fixed;
z-index:1000;
height:100px;
width:100%;
background:red;
top:0;
left:0;
}
.pdf_container{
position:absolute;
top:0;
left:0;
z-index:100;
}
Actually i want to show the #show_message over the .pdf_container and it works well in Firefox but not in IE , it ignoring the z-index.
Please help me to figure out the problem.
Thank you.
See Screenshots:
IN IE
IN IE 8,9
and in FF
IN FIREFOX
You will need to set WMODE to Transparent inside the embed tag.
<embed class='pdf_container' src='welcome.pdf' style ='width:100%;height:500px;' wmode="transparent" ></embed>
Try this you surly get solution as i did and its working fine in my local system :-) cheerss
Little diffrent form your code but i am sure you will get it.
http://jsfiddle.net/fRsUv/
html { height:100% }
#container {
position:relative;
width:100%;
}
#pdf {
width:100%;
z-index:1;
}
#layer_over_pdf {
width:200px;
z-index:2;
}
#pdf, #layer_over_pdf {
position:absolute;
top:0;
left:0;
}
<div id="container">
<div id="pdf"><embed id="pdfEmbed" src="JavaScript_DHTML_Mat_V4.pdf" style="width:500px; height:600px" type="application/pdf"></embed></div>
<div id="layer_over_pdf">some content</div>
</div>
Related
i have a ribbon on bottom of every report page with an image for call window.print().
i figure out it like this:
<div id="dgdPrint" class="hop">
<div id="dgdPrnImg" title="Print Report..." onclick="window.print();">
</div>
</div>
and i style it with:
#dgdPrint
{ position:fixed;
border-top:1px solid #000;
width:100%;
bottom:0;
right:0;
text-align:center;
height:55px;
margin-top:50px;
background-color:#88A7DB; }
#dgdPrnImg
{ margin-top:10px;
background-image:url('PrinterText.png');
background-position:center center;
background-repeat:no-repeat;
height:35px; }
#dgdPrnImg:hover
{ background-image:url('PrinterText-hover.png'); }
but whole of first div (ribbon) take this effect and on hover of any part of that the image is changed. what's wrong in my code?
It changes because you have background-image:url('PrinterText-hover.png'); } set under #dgdPrnImg:hover
I would like to know how to make a video or div stuck to a certain position while it will always be the size of the browser window. Here's what I want.
Their "background" contains a video, and if you drag the size of the browser window, you'll notice that it always resizes the video. This is what I'm trying to make.
Here is my code:
#menuContainer{
width:650px;
height:50px;
position:relative;
z-index:3;
margin-top:0;
margin-right:auto;
margin-bottom:0;
margin-left:auto;
background-color:rgb(183, 52, 178);
}
#menuLogo2{
height:50px;
width:126px;
}
#menuDevide1{
width:1px;
height:45px;
background-color:black;
position:relative;
top:-47.5px;
left:131px;
margin-top:auto;
margin-right:0;
margin-bottom:auto;
margin-left:0;
}
#menuDevide2{
width:1px;
height:45px;
background-color:black;
position:relative;
top:-119.5px;
left:260px;
margin-top:auto;
margin-right:0;
margin-bottom:auto;
margin-left:0;
}
#menuDevide3{
width:1px;
height:45px;
background-color:black;
position:relative;
top:-191.5px;
left:391px;
margin-top:auto;
margin-right:0;
margin-bottom:auto;
margin-left:0;
}
#menuDevide4{
width:1px;
height:45px;
background-color:black;
position:relative;
top:-263.5px;
left:520px;
margin-top:auto;
margin-right:0;
margin-bottom:auto;
margin-left:0;
}
#menuBottomline{
width:100%;
height:1px;
background-color:black;
position:absolute;
top:70px;
left:0px
}
#headerBG{
position:absolute;
top:0px;
left:0px;
z-index:2;
background-color:#ffffff;
height:70px;
width:100%;
}
.menuClick{
color:#000000;
text-decoration:none;
font-family: "Open Sans", Arial, sans-serif;
font-size:20px;;
}
.menuClick:hover{
color:#999999;
}
#menuPortfolio1{
position:relative;
top:-83px;
left:133px;
width:126;
text-align:center;
}
#menuServices1{
position:relative;
top:-155px;
left:263px;
width:126;
text-align:center;
}
#menuProcess1{
position:relative;
top:-227px;
left:393px;
width:126;
text-align:center;
}
#menuContact1{
position:relative;
top:-299px;
left:522px;
width:126;
text-align:center;
}
#mainOverlapWrap{
z-index:1;
position:relative;
width:100%;
height:100%;
}
#video1{
position:absolute;
top:71px;
left:0px;
min-width:1%;
width:100%;
height:100%;
}
#mainOverlay{
position:absolute;
top:0px;
left: 0px;
heightx:100%;
height:100%;
background-color: rgba(0,0,0,0.3);
}
Alternatively, you could check out this JSfiddle.
Please note, I am using their video as a placeholder. My intent is not to steal their work.
PROBLEM AFTER THE MAIN ISSUE HAS BEEN RESOLVED
When I resize my browser, I see this really small little grey edge on the right side. It tends to appear when I'm resizing to the left, but goes away when resizing to the right. This picture shows what I mean. JSfiddle can be found here. I hope you'll be able to fix this problem!
Perhaps it's best to copy the codes in JSfiddle and put them in files on your computer. The whole thing looks kinda weird in JSfiddle, but not in browsers.
HTML
<div class="wrapper">
<div class="h_iframe">
<iframe src="//www.youtube.com/embed/9KunP3sZyI0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
CSS
html,body {height:100%; margin:0;}
.h_iframe iframe {position:absolute;top:0;left:0;width:100%; height:100%;}
DEMO
DEMO 2
So here we go for tag
HTML
<div class="wrapper">
<video class="videoInsert">
<source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
</div>
CSS
.videoInsert {
position: absolute;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
background-size: cover;
overflow: hidden;
}
Final DEMO
So now we need jquery for it.
HTML
<div id="video-viewport">
<video autoplay preload width="640" height="360">
<source src="https://s3.amazonaws.com/whiteboard.is/videos/bg-loop-new.mp4" />
</video>
</div>
CSS
#video-viewport {
position: absolute;
top: 0;
left:0;
overflow: hidden;
z-index: -1; /* for accessing the video by click */
}
body{
margin:0;
}
js
var min_w = 300; // minimum video width allowed
var vid_w_orig; // original video dimensions
var vid_h_orig;
jQuery(function() { // runs after DOM has loaded
vid_w_orig = parseInt(jQuery('video').attr('width'));
vid_h_orig = parseInt(jQuery('video').attr('height'));
$('#debug').append("<p>DOM loaded</p>");
jQuery(window).resize(function () { resizeToCover(); });
jQuery(window).trigger('resize');
});
function resizeToCover() {
// set the video viewport to the window size
jQuery('#video-viewport').width(jQuery(window).width());
jQuery('#video-viewport').height(jQuery(window).height());
// use largest scale factor of horizontal/vertical
var scale_h = jQuery(window).width() / vid_w_orig;
var scale_v = jQuery(window).height() / vid_h_orig;
var scale = scale_h > scale_v ? scale_h : scale_v;
// don't allow scaled width < minimum video width
if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;};
// now scale the video
jQuery('video').width(scale * vid_w_orig);
jQuery('video').height(scale * vid_h_orig);
// and center it by scrolling the video viewport
jQuery('#video-viewport').scrollLeft((jQuery('video').width() - jQuery(window).width()) / 2);
jQuery('#video-viewport').scrollTop((jQuery('video').height() - jQuery(window).height()) / 2);
};
DEMO HERE
I find that the footer is displayed properly on Chrome but it looks like it doesn't get overflow:hidden; on Firefox. The wrapper div is still going a little more below the footer.
<div class="wrapper6"> // at gallery.html
<div class="wrapper8"> // at galeri2013.html
Here are CSS properties of these two wrapper divs:
.wrapper6 {
margin:0 !important;
padding:0 !important;
left:0;
top:0;
position:absolute;
background:url(../images/texture.png) repeat;
width:100%;
height:180% !important;
font-family: orator std;
overflow:hidden;
}
.wrapper8 {
margin:0 !important;
padding:0 !important;
left:0;
top:0;
position:absolute;
background:url(../images/texture.png) repeat;
width:100%;
height:280% !important;
font-family: orator std;
overflow:hidden;
}
And properties for both footers;
galeri2013.html;
.footy4 {
position:relative;
display:inline !important;
float:left;
z-index:1;
left:0;
margin-bottom:-4.3%;
transform:skewX(8deg);
-webkit-transform:skewX(8deg);
transform:skewY(-2.5deg);
-webkit-transform:skewY(-2.5deg);
background-color:#e81b1b;
width:100%;
height:120px;
margin-top:96%;
overflow:hidden;
}
gallery.html;
.footy7 {
position:relative;
display:inline !important;
float:left;
z-index:1;
left:0;
margin-bottom:-4.3%;
transform:skewX(8deg);
-webkit-transform:skewX(8deg);
transform:skewY(-2.5deg);
-webkit-transform:skewY(-2.5deg);
background-color:#e81b1b;
width:100%;
height:120px;
margin-top:150%;
overflow:hidden;
}
I think I'm not using best ways to handle it, if you see anything wrong/not the best way of coding please tell me so that I can learn and also improve myself.
To clarify again, I want to have my footer stuck to bottom on Firefox, as it is on Chrome!
Okay! After some hours I saw what's wrong... I've put the footer div into wrapper div and everything went normal!
So this is what I did to achieve it basically;
<div class="wrapper">
//some other content
<div class=footer>
//footer content
</div>
</div>
and I've put backoverflow:hidden; to wrapper which I had removed to test what is wrong. You can see what other css properties I've used up here at the question.
Hope these can be useful to someone and thanks for everyone who helped.
the code below demonstrates what i am trying to do. why is my "blackOut" div appearing in front of my "theGoods" div? shouldn't the z-index properly handle this?
<html>
<head>
<style>
table.theGoods{
display:block;
z-index:20;
background-color:yellow;
font-family:arial;
font-size:18px;
width:300px;
height:300px;
margin-right:auto;
margin-left:auto;
margin-top:180px;
text-align:center;
}
div.blackOut{
position:absolute;
background-color:red;
width:100%;
height:100%;
padding:0px;
top:0px;
left:0px;
z-index:2;
}
div.behindIt{
z-index:1;
background-color:red;
}
#myinnercontainer { position:absolute; top:50%; height:10em; margin-top:-5em }
</style>
</head>
<body>
<table class="theGoods" id="theGoods">
<tr>
<th>
la la
</th>
</tr>
</table>
<div class="blackOut" id="blackOut" onClick="myHider(event)"></div>
</body>
<script>
function myHider(e){
document.getElementById("blackOut").style.display="none";
}
</script>
</html>
z-index:20; has no effect without either position:absolute or position:relative. (You want the latter.)
z-index only affects elements with a position property other than 'static'. If you add position:relative; to table.theGoods, you should be fine. In general, all elements involved in the stacking need to have position:relative or position:absolute.
You cant use z-index without using:
position:absolute;
or:
position:relative;
which is lacking from table.theGoods
You need to add "position: absolute;" to the style for table.theGoods.
I have a picture that needs to be split into 4, and each part must have a link.
Do people still use image hotspots?
I am assuming you are talking about client side image maps.
They are still being used and are part of HTML 4.01 and XHTML 1.1, and also in the current HTML 5 draft.
They are simple to use and are supported by all browsers and as such are a good way to have "hot spots" on a single image. I can't think of a single better alternative (ease of use, browser support, accessibility, being part of the HTML spec) that will give you this functionality.
Whether having such "hot spots" on a single image is advisable (discoverability by the user being the main issue), is a different question.
Using images as links is lame in my opinion; it can hurt accessibility, and depending on the image used, can result in Mystery Meat Navigation, which is lame.
Instead, I'd make that image a background image.
HTML
<div id="image-hotspot">
Small Planets
Big Planets
The Sun
</div>
CSS
#image-hotspot {
background:url(http://onlyfunnyjokes.com/bestoftheweb/wp-uploads/earth_planets_size_comparison.jpg);
height:650px;
width:385px;
}
#image-hotspot a {
display:block;
text-indent:-10000px; /* you could also change the opacity instead*/
/* as a matter of fact I suggest using the opacity technique */
/* the text-indent has caused me troubles in the iPad browser */
height:216px;
}
You might need to use more advanced CSS positioning to make sure those anchor elements <a> are where you need them to be.
Addendum
Here's another example which should seem more relevant:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
<head>
<title >Test</title>
<style type="text/css">
#image-hotspot {
background:url(http://upload.wikimedia.org/wikipedia/commons/c/c4/Planets2008.jpg);
height:720px;
width:1280px;
position:relative;
top:0px;
left:0px;
}
#image-hotspot a#the-sun {
display:block;
text-indent:-10000px;
height:720px;
width:200px;
position:absolute;
left:0px;
top:0px;
}
#image-hotspot a#mercury {
display:block;
text-indent:-10000px;
height:25px;
width:25px;
position:absolute;
left:225px;
top:275px;
}
#image-hotspot a#venus {
display:block;
text-indent:-10000px;
height:75px;
width:40px;
position:absolute;
left:265px;
top:250px;
}
#image-hotspot a#earth {
display:block;
text-indent:-10000px;
height:75px;
width:45px;
position:absolute;
left:325px;
top:250px;
}
#image-hotspot a#mars {
display:block;
text-indent:-10000px;
height:75px;
width:45px;
position:absolute;
left:383px;
top:250px;
}
#image-hotspot a#jupiter {
display:block;
text-indent:-10000px;
height:125px;
width:135px;
position:absolute;
left:450px;
top:225px;
}
#image-hotspot a#saturn {
display:block;
text-indent:-10000px;
height:125px;
width:195px;
position:absolute;
left:610px;
top:225px;
}
#image-hotspot a#uranus {
display:block;
text-indent:-10000px;
height:75px;
width:60px;
position:absolute;
left:805px;
top:250px;
}
#image-hotspot a#neptune {
display:block;
text-indent:-10000px;
height:75px;
width:60px;
position:absolute;
left:887px;
top:250px;
}
</style>
</head>
<body>
<div id="image-hotspot">
<a id="the-sun" href="#the-sun">the sun</a>
<a id="mercury" href="#mercury">mercury</a>
<a id="venus" href="#venus">venus</a>
<a id="earth" href="#earth">earth</a>
<a id="mars" href="#mars">mars</a>
<a id="jupiter" href="#jupiter">jupiter</a>
<a id="saturn" href="#saturn">saturn</a>
<a id="uranus" href="#uranus">uranus</a>
<a id="neptune" href="#neptune">neptune</a>
<!-- <a id="pluto" href="#pluto">pluto</a> -->
</div>
</body>
</html>
You can use image maps, the main reason people don't like them is because people often map a small part of an image and you don't know it's a link. If you can, just wrap the each image in it's respect <a href='link'>img</a>