CSS - Find Id Of Elements Under A Css Positioned Div
Hi
I've come up on the old <select> elements showing through <div>s that are made visible on top of them. What I want to do is find out the id's of the select elements under my <div> so that i can hide them using CSS / Javascript. The basic layout of my page is a grid of <select> elements, each one of these would have a hidden <div> layer associated with it containing extra information etc. By the side of each of the <select> elements is a little image / button that the user will click and the layer with the extra stuff in is made visible. The layer will overlap a number of <select> elements (not the parent <select> element). Each <div> pops up in a different position (calculated dynamically as an x,y offset from the parent) can I find the Ids of the elements it overlaps? Hope this is clear, and thanks in advance. flipflops. Similar TutorialsThe form elements (<select> specifically) on a background layer seem to be showing through a <div> layer positioned above it (at least in IE.) Does anyone know a trick or some such to stop the form elements from the background from showing through the <div>? t h a n k s Can someone tell me how z-index calculated on two elements that are both absolute position Hi, I have been puzzle for a while now working out how to do this. I have two fixed height divs which I want to appear on the same line (inline). However to maintain the fixed height they cannot be set as display: inline; (Well that works in IE but not in Firefox). Anyway I find out that setting one div to float left and the other to float right with another div with clear:both works fine. However when it comes to setting the position of the flash elements I want in each div element it works now in Firefox but not in IE. I currently have: <div id="diva"> <object id="face1" width="320" height="110"> <param name="face1" value="face1.swf"> <embed src="face1.swf" width="320" height="110"> </embed> </object> </div> <div id="divb"> <object id="face2" width="320" height="110"> <param name="face2" value="face2.swf"> <embed src="face2.swf" width="320" height="110"> </embed> </object> </div> <div id="clear"></div> With the relavent css: #div1 { background-image : url(images/bg1.gif); width: 381px; height: 346px; float: left; text-align : center; vertical-align : bottom; } #div2 { background-image : url(images/bg2.gif); width: 381px; height: 346px; float: right; text-align: center; vertical-align : bottom; } #clear { clear: both; } img { border: 0px; } #face1{ padding-top: 220px; left: 30px; } #face2{ position: relative; top: 220px; left: 10px; } Effectively what I want is: Where the divs are on the same line and are fixed height (as they have a background) and then each swf element releatively positioned inside the div...which will work in Firefox and IE! Thank you for your time. Below is a simple test page that fails to load properly on the Mozilla browser. It appears to work properly in IE. Any suggestions to getting the span width to set properly, based upon the content of the span would be a great help. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Span test</title> <style TYPE="text/css"> .submenu { background-color: #FFFFFF; color: #D4BA6B; border-top: 0px solid #000000; border-left: 0px solid #000000; border-right: 0px solid #000000; border-bottom: 0px solid #000000; position: absolute; margin: 0px; padding: 0px; min-width: 100px; visibility: visible; z-index: 1; } .submenuItem { background-color: #FFFFFF; color: #000000; border-left: 2px solid #ff0000; border-right: 2px solid #ff0000; border-bottom: 2px solid #ff0000; border-top: 2px solid #ff0000; font-family: "arial narrow", arial, verdana, sans-serif; font-weight: normal; font-size: 12pt; padding-top: 2px; padding-bottom: 2px; padding-right: 5px; padding-left: 5px; position: absolute; z-index: 1; cursor: pointer; cursor: hand; } </style> <SCRIPT LANGUAGE="javascript"> function getWidth() { oSpan = document.getElementById("testSpan"); iWidth1 = oSpan.offsetWidth; alert ("Width1 = " + iWidth1); } </SCRIPT> </head> <body onload="getWidth()"> <div class="submenu"> <span class="submenuItem" id="testSpan">This is the item that I am testing today.</span> </div> </body> </html> I'm using a relative-positioned div as a container for an image, which is absolute-positioned. I'm doing this so that the image will automatically scale down to fit inside the containing div (nothing else I've tried has done this for me- so if there is another way to achieve this, please fill me in). This part works fine, but the image isn't as wide as the containing div, so I would like to center the image inside the div- but I can't seem to get it to work. I tried the obvious text-align:center in the div. That actually worked... kinda. The image's left-side was in the center of the div, but obviously isn't the 'centering' that I'm looking for. I then tried setting margin-left and margin-right on the image to auto, and that did nothing. I suspect that the fact that I have my image absolute-positioned is the culprit here, but I don't know how to get around it- or IF I can get around it without drastically changing my approach. Admittedly, the container div resides inside a table cell. I know that isn't the best practice, but I spent so much time trying a div-only approach only to waste time and become frustrated that I went back to what I know works- at least for now. I tried removing the container div from the table and inserting the image directly to the table cell- but encountered more issues with the sizing of the image. Essentially, my code is something like this: CSS: Code: td#CONTENTDISPLAY { width: 100%; height: 100%; text-align: left; vertical-align: top; padding: 0 0 0 0; margin: 0 0 0 0; } div#CONTENTBANNER { position: relative; height: 100%; padding: 0 0 0 0; } img.CONTENTIMG { position: absolute; height: 100%; } HTML: Code: ... <td id="CONTENTDISPLAY"> <div id="CONTENTBANNER"> <img class="CONTENTIMG" /> </div> </td> ... Nothing flashy, I know. One thing I should mention, however, is that the image is ALWAYS placed inside the container div using a Javascript function (it's a dynamic image). I doubt that makes a difference, but I figure it's worth mentioning. Can anyone help point me in the right direction? Thanks! - skubik Hello all, I'm having a bit of trouble with a list of relative, floated <li> elements, each containing a single absolutely positioned div that appears on hover. I'm using the :hover pseudo-class currently but I will use JavaScript for IE6 once it displays correctly. The code is below. The problem is that the <div> appears on top of it's parent element but behind all other elements. Code: #wrapper-body ul.staff-list{ list-style-type:none; padding-top:10px; position:relative; } #wrapper-body ul.staff-list-team{ width:313px; padding-top:0; padding-bottom:15px; margin-bottom:20px; border-bottom:1px solid #d7e3a9; } #wrapper-body ul.staff-list li{ float:left; width:230px; position:relative; padding:8px 0 8px 15px; z-index:1; } #wrapper-body ul.staff-list-team li{ width:151px; padding-left:0; padding-left:5px; } #wrapper-body ul.staff-list-team li.right{ padding-left:5px; } #wrapper-body ul.staff-list-clerks li{ float:none; width:310px; padding-left:5px; } #wrapper-body ul li.highlight{ background-color:#f4f6ec; } #wrapper-body ul.staff-list li p{ padding:0 0 9px 0; margin-left:91px; } #wrapper-body ul.staff-list li small{ padding:0 0 5px 0; margin-left:91px; } #wrapper-body ul.staff-list-clerks li span{ color:#A6302B; display:block; float:left; } #wrapper-body ul.staff-list-clerks li span.clerk-name{ width:140px; } #wrapper-body ul.staff-list-clerks li span.clerk-phone{ width:120px; background:url(../img/structure/clerks-phone.gif) 0 2px no-repeat; padding-left:23px; } #wrapper-body ul.staff-list-clerks li a.clerk-email{ display:block; float:left; height:16px; width:16px; background:url(../img/structure/clerks-mail.gif) 0 3px no-repeat; } #wrapper-body ul.staff-list li div.staff-list-detail{ display:none; background:url(../img/structure/staff-list-bottom.gif) left bottom repeat-x; padding-bottom:3px; margin-top:-15px; left:4px; z-index:10; top:15px; position:absolute; } #wrapper-body ul.staff-list li div.staff-list-detail a{ background:url(../img/structure/staff-list-bullet.gif) no-repeat 0 4px; padding-left:8px; } #wrapper-body ul.staff-list li:hover div.staff-list-detail{ display:block; } An image of what is happening below: Thanks for reading! I have a Calendar of Events that I actually made quite a while ago, and it works great, but now I'm incorporating it into a different site... I used to handle the events on the calendar with absolutely positioned spans, but I'm going to try and do something a little different (being able to have tooltip like hovers with the possibility of using lists in the hover), and you can't do that with spans... but my css doesn't seem to be behaving properly. I've got some example data, the event(bitcalevent) is supposed to sit on the bottom of the day(bitweek div), but it doesn't... when it was a span it did (though I had to add border:0 and width:100%)... maybe there is another rule that I'm not seeing that isn't letting this happen??? [edit]Note that I made the bottom -10px just so it looks ok for now... but it's like it's not separating the bottom from the top... [/edit] Hey all, I am creating a site which sells Three 3G Mobile Phones and at the bottom of the pages i have a footer which is included into each page, see here. If you view the site in Firefox then the footer is in the correct place and rests just where the main content finishes. However in IE the footer is miles down the page creating a box effect arround the content which to be honest looks crap. If anyone would be so kind as to give me an idea why this is happening then i would be very grateful. Also, there are many sites around which give tutorials etc about text decoration and such with CSS, but i am yet to find a really good begginers tutorial on how to layout a page with CSS and Divs, does anyone know of one? Thanx for reading. CSS Code (siteInfo is the footer in question: Code: #masthead{ padding: 0px 0px 0px 0px; border-bottom: 1px solid #cccccc; width: 100%; } #navBar{ float: left; width: 15%; margin: 0px; padding-right: 2px; height: 100%; } #headlines{ float:right; width: 45%; padding-right: 2px; } #content{ float: left; width: 70%; padding: 0px 0px 0px 0px; background-color: #FFFFFF; position: inherit; } #siteInfo{ clear: both; font-size: 75%; color: #FFFFFF; padding: 10px 10px 10px 10px; text-align: center; background-color: #CCCCCC; border-top: 1px solid #107FA4; position: relative; font-weight: bold; } Edited to add CSS. Hello all, I dont understand why the image placed inside the right column appears incorrect here. Please check the attachment or the following website and you will understand what I am refering. http://www.refinethetaste.com/yk/clients.asp Code: #content { float:left; width: 956px; min-height:800px; background:url(images/bg_content.gif) 0px 0px #e2eceb no-repeat; } #content #lcolumn { float:left; width:401px; } #content #lcolumn .logo { float:left; width:100%; } #content #lcolumn img.logo { float:left; width:401px; height:104px; border:0px } #content #lcolumn .head { float:left; width:100%; height:20px; background:#99adcc; } #content #lcolumn .head .text { float:left; width:100%; text-align:center; font-size: 13px; font-weight:bold; line-height:20px; color:#083684; } #content #lcolumn .main { float:left; width:361px; padding:20px; } #content #lcolumn p { font-size:15px; } #content #rcolumn { float:left; width:555px; height:505px; } #content #rcolumn img { float:left; border:0px; } hey guys JonnoWalmsley.com is giving me grief. I have a nav bar which is position:absolute; bottom:0px (so stuk to the bottom of the screen at all times, with the appropriate z-index etc). It works fine on FF, but IE seems to be starting from the center of the page, which effectively pushes the nav bar over to the right, and partially off the screen on smaller screens. Code: <div style="position:fixed; bottom:0px; background-color:#0a2a1a; width:899px;">...nav links...</div> I need IE to render the same as FF, and start the nav panel from the left. Any ideas? IE Screenshot FF Screenshot We don't use position absolute for anything else on our site, but it seems that our drop down still goes under some content. Here is the css: Code: #nav { background-image: url('../images/nav-full-bg.jpg'); background-repeat: repeat-x; width: 967px; height: 69px; padding: 0; margin: 0; overflow: hidden; } #nav, #nav ul { /* all lists */ padding: 0; margin: 0; list-style: none; line-height: 1; } #nav a { display:block; padding: 11px 12px 13px 12px; font-weight:bold; font-size: 13px; font-family: "Trebuchet MS", Bitstream Vera Sans, Verdana; color: #626262; margin: 0; text-decoration: none; } #nav li { /* all list items */ float: left; } #nav li ul { /* second-level lists */ position:absolute; width: 200px; left: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */ border-bottom: 2px solid #808080; background-image: url(../images/davidpng2.png); z-index: 900; } #nav ul li { float: left; width: 10em; /* width needed or else Opera goes nuts */ } #nav li ul li a{ padding:5px; display: block; width: 190px; color: #000; font-weight:normal; font-family:verdana; font-size:11px; } #nav li ul li a:hover{ background-color:#a2c9f4; } #nav li ul ul { /* third-and-above-level lists */ margin: -23px 0 0 200px; ; } #nav li ul li ul li a{ display: block; } #nav li:hover ul ul, #nav li.sfhover ul ul { left: -999em; } #nav li:hover ul, #nav li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul { /* lists nested under hovered list items */ left: auto; } I'm getting a strange interaction between a CSS-positioned image and a widget placed farther down the page. I've tested it in FF3.5.7 and IE8, and everything works fine until I test it in Compatibility View in IE. The widget takes a few seconds to load; once it's loaded the image at the top of the page disappears. The layout is basically this: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head></head> <body> <table> <tr> <td><div style="position:relative;margin:50px 0 0 0"> <table> <tr> <td>Some content</td> <td rowspan="2"><img style="position:relative;margin:-50px 0 0 0" src="#" width="250" height="375" /></td> </tr> <tr> <td>Some content</td> </tr> </table> <table> <tr> <td>Some content</td> <td><img style="visibility:hidden;width:0px;height:0px;" border="0" width="0" height="0" src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNzY2NTc4MzAyNzAmcHQ9MTI3NjY1ODUyNzM1MiZwPTEwODQwMDEmZD*mZz*yJm89MDQ2ZDg3MzBjNDc4NDExZTkw /YTVmZDcxNzhiYmQ1MGYmb2Y9MA==.gif" /><object width="394" height="350" id="W4afb54b3f6d091a24b057108737c9fbe" data="http://www.5lovelanguages.com/widget/5LL-assesment-widget.swf" type="application/x-shockwave-flash"> <param value="http://www.5lovelanguages.com/widget/5LL-assesment-widget.swf" name="movie"/> <param value="transparent" name="wmode"/> <param value="all" name="allowNetworking"/> <param value="always" name="allowScriptAccess"/> </object></td> </tr> </table> <table style="position:absolute;left:0;top:-50px"> <tr> <td>Some content</td> </tr> </table> </div></td> </tr> </table> </body> </html> I don't know anything about how the widget works. Can anyone help me fix this problem? I'm make a simple display:hidden , display:visiable "pop up" div box. The popup works wonderful in FF but IE, the button does not display. Here is my full page (short and simple) Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> function DIVshow(div_id) { var popUp = document.getElementById(div_id); popUp.style.visibility = "visible"; } function DIVhide(div_id) { var popUp = document.getElementById(div_id); popUp.style.visibility = "hidden"; } </script> <style type="text/css"> #popupcontent { position: absolute; top: 50%; left: 50%; width: 300px; height: 200px; margin-left: -150px; margin-top: -100px; visibility: hidden; overflow: hidden; background-color: #F6F6BB; border: 1px solid #333; padding: 5px; } </style> </head> <body> <p><a href="#" onClick="DIVshow('popupcontent');">Click here</a> to open the popup.</p> <div id="popupcontent"> <p>This is a popup window!</p> <input type="button" value="close" onClick="DIVhide('popupcontent');" /> </div> </body> </html> Working sample can be seen he Click Here It works in both IE and FF if I write my hidden div tag like this: Code: <div id="popupcontent"> <div> <p>This is a popup window!</p> <input type="button" value="close" onClick="DIVhide('popupcontent');" /> </div> </div> Obviously I want to avoid the extra div tags if possible. Anybody know what happening here and how to fix it? Thanks! Hi. I have a page with 3 absolutely positioned columns. I want the footer to set right underneath the main content. Currently I have a container for the main content and a footer <div> that sits outside of this container. However, certain browsers (NN7 & IE6) are pushing the footer down too far. Anyone know how I can control this? Here's my css: #container{ position:relative; height:100%; width:780px; } #footer { position: relative; top: 0px; left: 0px; clear:both; } Hello I'm running into a very simple CSS problem (IMHO). I'm hoping that someone will be able to help out. The problem is related to a div layer that I'm positioning. The layer is positioned fine, but there is a gap at the bottom of the page where the div was created, eventhough it's positioned else where. This gap only happens in IE, FireFox looks great (no gap). Basically the code is this: Code: <div id="right-footer"> <img src="images/logo_small.gif" border=0><br /> </div> This is at the bottom of the page, above the </body></html>. I have content on the page, so scrolling is necessary. The gap is approximately 40px tall. Here is the relevant section of the stylesheet: Code: #right-footer { position: relative; top: -100px; left: 550px; width: 100px; height: 10px; overflow: none; z-index: 100; padding: 0px; margin: 0px; } As you can see, the layer will be positioned above where div is in the code and pushed to the left, it's height is 10px. I added the z-index, overflow, padding, margin in a desperate attempt to fix it. Commenting out the div block or setting position to absolute removes the gap, but my position is blown. Any ideas? Please let me know if you need any more information or code. Thanks! hanji I cannot get the footer to sit at the bottom of the page when I use absolute positioning. I need the #main to stretch to whatever the content height and the footer to sit underneath. I know its fairly easy to achieve with relative positioning but I need absolute positioning for for other elements. Can anyone help? html, body {height:100%;} #container { width: 900px; position: absolute; top: 0px; left: 50%; margin-left: -450px; } #header { width: 900px; height: 105px; position: absolute; left:0; top: 0; } #main { position: absolute; left:0; top: 105px; } #footer { position:absolute; bottom:0; border: 1px solid yellow; } hi, I've run into a bit of a problem... I'm trying to set up a drop down menu in my navigation bar. I'm using the method from www.gazingus.org/html/menuDropdown.html it works except for the fact that it hides behind a relatively positioned element - sa-ewb.org.uk/trial/about_us.htm can I use z-index to fix this? I'd really appreciate some help on this! thanks, Jim. Sorry if this has been discussed, I can't seem to find it if it has been. I'm attempting to absolutely display several <div> tags, with padding and a set width/height. However, when I place them side by side, the borders overlap, and the width/height is larger than the values I've assigned. Is there some sort of formula to calculate the left, top, width and height values to make it so they do not overlap, the padding is applied, and the correct width/height is displayed (cross-browser, back to at least IE 6)? Thanks! I have a problem with my background image. I need to centre the background image and center the container div on top of that. I have used the below CSS which has the desired effect in Mozilla but for some reason in ie, the background moves depending on browser size when it needs to stay put! Any ideas? body { font-size: 0.70em; font-family: Arial, Helvetica, sans-serif; text-align: center; background:#ffffff url('../images/content_bg.gif') top center no-repeat; color: #303030; height:100%; min-height:100%; } #container { width: 900px; text-align:left; position: absolute; margin-left:-450px; left:50%; z-index: 100; } |