CSS - Ie Adjacent Css Selector Not Working
Hey everyone,
I have a footer with two images that link to various associations for home building. In firefox when I over over the link which has a nested image. The next element is a paragraph which is hidden unless the link is hovered over. In IE the paragraphs don't show. I don't know why since I'm using a:hover, well actually it's #link-ID.hover. PHP Code: <div id="footer" style=""> <div id="foot-left" style=""> <div id="cedia"> <a id="cedia-link" href="http://www.cedia.net/"> <img src="images/cedia.png"> </a> <p id="cedia-info"> Custom<br> Electronic<br> Design &<br> Installation<br> Association </p> </div> <div id="ochba"> <a id="ochba-link" href="http://www.gohba.ca/"> <img src="images/ochba.png"> </a> <p id="ochba-info"> Ottowa-Carleton<br> Home<br> Builders<br> Association </p> </div> </div> <div id="foot-right" style=""> <p>To contact us:</p> <address> Phone: 613-838-4800<br> Fax: 613-838-3800<br> Email: info@moorhousecabling.ca<br> 9 Mary Hill Crescent, Richmond, Ontario, K0A 2Z0 </address> </div> </div> Code: css #footer{ float:left; clear:both; width:800px; overflow:hidden; height:140px; } #foot-left{ float:left; clear:none; width:216px; height:100%; } #cedia{ font-size:small; width:50%; float:left; clear:none; } #cedia-link:hover + #cedia-info{ display:block; } #cedia img{ margin-left:40px; float:left; clear:none; border:0; } #cedia-info{ margin:0 0 0 40px; padding:0; display:none; float:left; clear:both; } #ochba{ font-size:small; width:50%; float:left; clear:none; } #ochba-link:hover + #ochba-info{ display:block; } #ochba img{ margin-right:40px; float:right; clear:none; border:0; } #ochba-info{ margin:0; padding:0; display:none; float:left; clear:both; } #foot-right{ float:left; clear:none; background-color:#e6232b; font-size:x-small; padding:20px 0 0 20px; height:100%; width:563px; color:#ffffff; font-weight:bold; } Unfortunately no matter what I do to my routers firewall, including turning it off and also trying to add the webserver host to the DMZ. Either way all the port scanners I've used said that port 80 was not responding to SYN connection requests at all. Basically the port is in stealth mode. I cannot give you a live sample of the site. Any ideas or help would be greatly appreciated. Similar TutorialsHi, So, there's the adjacent child selector element + element, but I was wondering if there was something that did the reverse of that selector. For example, let's say I have this: Code: <div id="menu"> <div class="option">1</div <div class="option">2</div> <div class="option">3</div> <div class="option">4</div> </div> I know I can use the element + element selector to quickly style every option div but the first, but is there some selector to quickly style every option element but the last. Thanks. --Surgery Hi everyone, Been racking my brains trying to figure out why a class is not being applied to a div, then i narrowed it down and realised that the ID selector is always taking precedence to the class attribute. Consdier this html page: Quote: <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Page</title> <style type="text/css"> #container { background-color: red; width: 100px; height: 50px; } .change_bg { background-color: green; } </style> </head> <body> <div id="container" class="change_bg" ></div> </body> </html> The div's background color comes out red and not green, as one would expect. Why is this happening? aren't styles supposed to be cascading? isn't that what CSS is all about? I can use !important but i want to know why it's not doing what is expected. Many thanks Internet Explorer 7 has an odd way of dealing with adjacent left and right floats in a container without set width. Instead of leaving the parent div to its natural content width as a float, IE7 forces the right-floating div to float right until it meets an element with a fixed width, or otherwise the document margin. IE8 and other browsers float the items correctly. The example below was meant to do a menu with rounded buttons, the two rounded images floated to the left and right edges of the button containing the text. The button should only be the width of the text link plus the rounding divs. This is easily fixed by adding a fixed width to the floating container div. However this may not always be the desirable action when div content widths may vary -- especially if space is at premium. Is there any decent way to fix this without resorting to ugly hacks? An easy way to make rounded corners for buttons that are floating. Perhaps use ul/li as the menu item container elements -- would that make any difference? ul/li come with their semantic limitations however, as far as their contents are concerned. (No divs for one.) Code: <!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"> <head> <title>Test Page</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> body{ background-color:#ffffff; font: 12px Verdana; } .container { border: 1px solid #000; padding: 5px; background-color: #eee; width: 500px; } .button_holder { float: left; margin: 1px; /* width: 100px; */ /* IE7 wants width! Comment out and it floats right. */ } .top_button_left { /* background-image: url(../images/top_button_left.png); */ background-repeat: no-repeat; background-color: #bbb; width: 5px; height: 31px; float: left; cursor: pointer; } .top_button_right { /* background-image: url(../images/top_button_right.png); */ background-repeat: no-repeat; background-color: #bbb; width: 5px; height: 31px; float: right; /* This bugs the hell out of IE7: right float inside left float floats to the right of the first container with specified width */ cursor: pointer; } .top_button_mid { /* background-image: url(../images/top_button_mid.png); */ background-repeat: repeat-x; background-color: #ccc; height: 31px; cursor: pointer; float: left; } .top_button_link { padding-top: 7px; padding-left: 13px; padding-right: 13px; text-align: center; } </style> </head> <body> <div class="container"> <b>Three buttons, the sides of which float to the right extreme in IE7</b> <br /> <br /> <div class="button_holder"> <div class="top_button_mid"> <div class="top_button_right"></div> <div class="top_button_left"></div> <div class="top_button_link"> <a href="index.html" title="Home">Home</a> </div> </div> </div> <div class="button_holder"> <div class="top_button_mid"> <div class="top_button_right"></div> <div class="top_button_left"></div> <div class="top_button_link"> <a href="other.html" title="Home">Other</a> </div> </div> </div> <div class="button_holder"> <div class="top_button_mid"> <div class="top_button_right"></div> <div class="top_button_left"></div> <div class="top_button_link"> <a href="weather.html" title="Home">Weather</a> </div> </div> </div> <br style="clear: both;" /> </div> </body> </html> i have two p tags one after the other.. <p>text</p> <p>text</p> and I did: Code: #head p { float:left; margin-top:2%; font-style:oblique; font-size:150%; color:green; } #head p+p { float:right; font-size:75%; color:red; } the problem is that if i do margin-top:4% to the first p; this also changes that in the adjacent p? is this correct? I am trying to create something similar to tooltips and having a problem. I know that the browsers support tooltips with the title attribute but I'm looking to do something different. Also, I know that IE has bugs with hovering on non-anchor tags but I'm trying to make this work in a standards-compliant browser (I'm not using IE). I've tried the code given by SantaKlauss and it worked fine. But why doesn't this work (a simple example to illustrate the problem)? Code: <style type="text/css"> .test:hover + div { background-color: red; } </style> <img class='test' src='test.gif' /> <div>here is some text</div> If I remove the :hover pseudo-class declaration like this: Code: .test + div { background-color: red; } It correctly sets the background color on the div following the image. So why doesn't the first example work with the hover pseudo-class?? Thanks in advance, Jeremiah So I'm trying to be "proper" and move from tables to divs. But one thing keeps getting me. Say I have a shadow that is to the left and right of my center content page. Easy enough w/ tables. (I'm really dumbing this all down). <table> <tr> <td background="images/shadow.gif"><img src="images/spacer.gif"></td> <td>My content here<br /><br /><br />etc.</td> <td background="images/shadow_r.gif"><img src="images/spacer.gif"></td> </tr> </table> In tables, that height of the left and right cells automatically move with the content of the right cell, so that if there's more or less text, the shadow gets longer or shorter. Now, this is how I'm seeing DIVs would work. <div style="float:left; background-image:url(../images/shadow.gif);background-position:top right; background-repeat:repeat-y;"><img src="images/spacer.gif"></div> <div style="float:left">My content here<br /><br /><br />etc.</div> <div style="float:left; background-image:url(../images/shadow_r.gif);background-position:top left; background-repeat:repeat-y;"><img src="images/spacer.gif"></div> But in this case, the divs to the left and right do not automatically adjust to be the height of the div in the center. So I just get one pixel of height for the shadow "cells". Is there a way to use CSS and still do this? Thanks, JBL I actually am having two problems, the one I alluded to in the subject and one I posted previously but got no response. This time, I'm including a URL and a CSS link in the hopes that someone might be able to help me out. The problem I posted earlier is regarding my navigation column and footer being omitted about 80% of the time in IE5/Win. Obviously, that's a huge problem. Of the browsers I've tested, it only happens in IE5/Win. The second problem is a bizarre issue regarding list items and the copy of the website. For some reason, in both IE5/Win and IE6/Win, the copy in the main column is slightly indented when there are list items (i.e. my navigation links!). This doesn't happen in any other browser I've tested and let me tell you, it's really cramping my style, because it makes the copy look like crap. Anyway, here's the URL of a test page: I've removed the page link. And here's the CSS link: http://dev.homedecorbuyer.com/stylesheets/default.css * Note: about 8 lines of CSS are on a different stylesheet, but only have to do with color and the header graphic. Please help. Whenever I can lend a helping hand on this forum, I post; it's my way of paying it forward. Any assistance would be greatly appreciated. Does anyone know how I can place two adjacent divs to fit the full width of the browser when one div is a set pixel width and the other i think has to be %? Here's my code: Code: <div style="position: absolute; top: 0px; left: 0px; width: 260px;"> <a href="http://www.thencollection.com/"><img src="images/logo.jpg" width="260px" height="55px" border="0" alt="The N Collection Logo" /></a></div> <div style="margin-left: 260px; width: 100%; height: 55px; background-color: #FFDC00;"> </div> Right now the header extends the browser width. Thanks in advance! Hi All, A seemingly simple problem which has me pulling my (already thinning) hair out: I'm working on a simple page header: a 100px-wide image floated to the left, a 150px wide div filled with text floated to the right. I need the header to stretch to fit the whole page, which is easy enough: float the image to the left, float the div to the right. Now, if a user shrinks the browser to, lets say 200px wide, it's forcing the div to stack below the image. I would like for it get closer and closer to the image as the browser is narrowed, until it's sitting just beside it. I can do this with a min-width on a container div, but of course, that doesn't work on IE--and I'd rather not use the "expression" min-width hack. I could do it with a table, but I'm trying to go table-free if I can. It seems like something that should be easy as pie, but I'm finding that it's more akin to baking a souffle. Thanks, all. rjgfx I'm a bit baffled on this issue. Please visit this page - www.atrachapter.com Focus on the main image in the body of the page and mouse over the left hand navigation. The image jumps to the left. I have tried looking at all the css to see what is causing this but am baffled. Any help would be apprecaited. Thanks. Tom Hi all 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" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> </head> <body> <table style="margin-bottom: 10px;" cellspacing="0" cellpadding="0"> <tr> <td>asdf</td> </tr> </table> <p style="margin-top: 10px;">asdf</p> </body> </html> Why do the margin-bottom of the table and the margin-top of the p not collapse (only tested in Firefox2)? Why is there 20px between them? I don't understand the world of margins anymore... Is this an exception or a bug or what? Thanks for help, Josh Is there a CSS selector that only IE5 will detect? I have my site working fine in IE6 and Firefox now and it displays legibly in IE5 but the padding is a bit off. Is there a selector I can use (such as * for IE in general) to make a change to the padding on IE5. Or should I be looking into loading separate CSS files dependent on the users browser? is there a specific order in which to put the css selectors in a style sheet, eg a:link a:hover a:active a:visited my problem is that the hover state isn't activated for links i have already visited. thank you Hi, I check my css file on 3wc. you will find the error messages/warnings and my css code in this link http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Falicelee.no-ip.com&usermedium=all I did some research on ID selector. I still don;t understand understand why 3wc css validator cannot recognize ID selector... how should i correct the errors and warning? i have already done the html validation... it is error-free and valid in html 4.0 thanks Can someone help me with this issue? I've looked through the selector section of the CSS2.1 spec, but I can't find anything about it. Consider the following CSS excerpt (real life example): Code: #attachments table td, #attachments table th { padding: 0 1em; } Lots of extraneous text in there, right? Isn't it possible to do something like this instead: Code: #attachments table (td, th) { padding: 0 1em; } Or at least something similar? Can anyone help poor little me with this? Can CSS select the first word in a Div? If so how? Example: first word in a pharagraph. I have three INPUT elements in a row and I want to apply different formatting to the second two. I know I can use: input+input { } This affects all but the first of the INPUT elements, which is exactly what I want. However, this works only with NS/Mozilla, and not MSIE. There is a way to apply CSS based on words within the value of the element, but I'm not sure how it works. For instance in the code: <INPUT type="submit" name="Submit" value="Browse"> I think there's a way to say "apply this style if the word 'BROWSE' is present in the element", but I can't make it work. Also, I know I can apply a CLASS to the element, but I'd like to not touch the HTML and use strictly CSS if possible. Can anybody help with this? Thanks. I have a large data sheet with individual td IDs, numbered 1 to 49 (first 3 shown for reference). <td id="data_cell_1"> <td id="data_cell_2"> <td id="data_cell_3"> I have been trying to apply a style to all of them (No I don't want to use a class, because they override the id's don't they? Or could I apply both a class and id to an element?) td[rel~="data_cell_"]:hover{background: #87F0FF;} td#[rel~="data_cell_"]:hover{background: #87F0FF;} td[id~="data_cell_"]:hover{background: #87F0FF;} td#[id~="data_cell_"]:hover{background: #87F0FF;} None of those worked. Isn't there a way to select all ID's based on partial information? I'm new to CSS but have read more in the past two days than I care to tell you about. I'm stuck on how to reference a deeply nested element that is automatically generated by a drupal view. The problem lies with the fact that I can select it directly and style it but other views (pages) are rendered with the exact same attributes (Name, Class, and ID). The Class of the page or view is different but is nested about seven tags back. My question is: How can I select the Element to be styled when the only differentiator is so far back in the hierarchy of the page without using a local or inline CSS? The following are snippets of the two pages that share the same Element attributes (<select name="filter0" class="form-select" id="edit-filter0" >) Thanks for any suggestions you might have. Mike ********* First page ******************* Code: <div class='view view-firstview'> <form action="URL" method="get" id="views-filters"> <div> <table> <thead> </thead> <tbody> <tr class="odd"> <td> <div class="form-item"> <select name="filter0" class="form-select" id="edit-filter0" > <option value="**ALL**"><All></option> </select> </div> </td> <td> <div class="form-item"> <select name="filter1" class="form-select" id="edit-filter1" > <option value="**ALL**"><All></option> </select> </div> </td> <td> <input type="submit" id="edit-submit" value="Submit" class="form-submit" /> </td> </tr> </tbody> </table> </div> </form> </div> ******** Second Page ******************** Code: <div class='view view-secondview'> <form action="URL" method="get" id="views-filters"> <div> <table> <thead> </thead> <tbody> <tr class="odd"> <td> <div class="form-item"> <select name="filter0" class="form-select" id="edit-filter0" > <option value="**ALL**"><All></option> </select> </div> </td> <td> <div class="form-item"> <select name="filter1" class="form-select" id="edit-filter1" > <option value="**ALL**"><All></option> </select> </div> </td> <td> <input type="submit" id="edit-submit" value="Submit" class="form-submit" /> </td> </tr> </tbody> </table> </div> </form> </div> Hello friends How can i define a css rule with an ID selector for two or more different ID's for an <div> element thanks |