CSS - Inline Divs Go Nuts When They Contain A List
Hello,
I am trying to display a three column menu (each column is a list). I created a single container. Within that I created three more containers(each about 33% width). Each internal <div> for the separate columns are set to inline. When I put text in each of the 4 pairs of <divs> they display side by side. Just fine. But If the DIV contains a list, despite the fact that the DIVs defined as inline, it still drops to the next line and things like the background color don't even render. All of the box styles are identical except for the background color. Shouldn't the <DIV> (defined with the display:inline) let me place whatever I want inside it? Just out of curiosity, I changed the first column into a 1 item list and it sifted to the right,.I don't know what that was based on. It also seemed to act like a block display, everytning went to the next line, and the background color was ignored. But the color attribute did render. ????? I haven't seen anything discussing the issues with defining lists inside of inline DIVs. I'm working with Firefox because that follows the standards better than IE although I have to make it work w/ IE too. What did has me pounding my head is how a UL tag seems to wipe out most (but not all) of the settings for the DIV containing it. I am thinking of making the columns each list items as a work around but I don't know why what I tried doesn't work. Thanks! Randy This is an simple example: Code: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style> #box1 { width:100px; height:100px; background-color:#FFFF33; display:inline; } #box2 { width: 100px; height: 100px; background-color:#FF8833; display:inline; } #box3 { width: 100px; height: 100px; background-color:#88FF33; display:inline; } #box4 { width: 100px; height: 100px; background-color:#CCCCCC; display:inline; } #container { width: 550px; height 150px; background-color:#CC66FF; } li { list-style:none; } </style> </head> <body> <div id="container"> <div id="box1">Column 1</div> <div id="box2">Column 2</div> <div id="box3">Column 3</div> <div id="box4"> <ul> <li>Column 4</li> </ul> </div> </body> </html> Similar TutorialsHello, I'm trying to make a neat CSS version of the tabled "itembox" in the attached image. I've got this far: http://offhourscomputing.com/ibdev.php The CSS for that page is: Code: /*Item Box*/ #ib{ margin:10px; width:38%; overflow:hidden; padding:3px; border-top:2px solid #eaeaea; border-right:2px solid #eaeaea; border-bottom:1px solid #eaeaea; border-left:1px solid #eaeaea; } #ib #l{ width:25%; border-right:#eaeaea 1px dashed; } #ib #r{ width:75%; display:inline; } #ib #r #n{ font-size: 12px; font-family:Arial, Helvetica, sans-serif; text-decoration: none; color:#000000 } #ib #r #n,#m{ display:block; } /*Item Box*/ How can i have: "SAMSUNG 40GB 7200RPM Light and Slim IDE Hard Drive, Model SP0411N, OEM Drive only ...More Testing" inline with the image? (looking similar to the attached screenshot of the item boxes) Thanks. Since this is my first post here, Hello, everyone! I can't find the answer to this simple question anywhere else, so I hope you can help. When a block-level (by default) element is set to "display: inline", can it still contain other block-level elements? BTW I want to avoid using "display: inline-block" since it is not as well-supported. Thanks a bunch, Rachel I'm having some problems with creating a layout using nested 'divs' displayed as inline-blocks. I know that for FireFox 3.0 all that needs to be done is display:inline-block; and for IE lte 8 I need to trigger layout in the 'divs' and then set them as display:inline; To my understanding setting display:inline-block; triggers layout in IE (as does zoom: 1; or giving the div depth; height and width) Then all you need is to do is <!--[if lte IE 8]> <style> display:inline;</style><![endif]--> I've achieved this layout style in a previous website, yet with the exact same technique my results are nill. Can someone please compare at my code in ff3 and IE and tell me what I'm doing wrong.
Code: <html> <head> <!--[if IE]> <style type="text/css"> #container div {display:inline;} #ul_top li {display:inline;} #header p {display:inline;} #main_content div {display:inline;} #recreation div {display:inline;} </style> <![endif]--> <style type="text/css"> body {padding:0px; margin: 20px 0px 0px 20px; } h1 {color:#990D0D; font-size: 20px; text-indent: 40px} #limiter {width: 1003px; } #ul_top {margin:0px; text-align:right; } #ul_top li {display:inline-block; zoom:1; padding: 0px 5px 0px 0px; } #ul_top li a {color:#000; text-decoration:none; font: veranda; font-size: 11px; } #ul_top li a:hover {color:#DE6800; text-decoration: none; font: veranda; font-size: 11px; } #container {border: solid #000 1px; background: #FFF url('background.jpg'); text-align:left; width: 1000px; height: 750px; } #header {width:1000px; height:303px; background:#yellow url('red_rock_header.jpg') no-repeat; } #header p {display:inline-block; zoom:1; font-size: 20px; } p.company_name:first-letter { color:#990D0D; font-size:40px; } #main_content div {display:inline-block; vertical-align:top; zoom:1;} #recreation {width:430px;} #recreation div {display:inline-block; vertical-align:top; zoom:1;} #text_holder{ border-right: dashed black 1px; padding:15px; width: 375px;} a.rec_links {color:#DE6800; font-size: 18px; } a.rec_links:hover {color:#000; font-size: 18px; } a.pic_links { display:block; position: relative; width: 200px; height: 160px; } #climbing {border: solid #FA9928 1px; -moz-border-radius: 10px; -webkit-border-radius: 10px; width: 200px; height: 160px; padding: 5px; margin-top: 5px; background: orange url('climbing.jpg') no-repeat; } #bicycling {border: solid #FA9928 1px; -moz-border-radius: 10px; -webkit-border-radius: 10px; width: 200px; height: 160px; padding: 5px; margin-top: 5px; background: orange url('bicycling.jpg') no-repeat; } #hiking {border: solid #FA9928 1px; -moz-border-radius: 10px; -webkit-border-radius: 10px; width: 200px; height: 160px; padding: 5px; margin-top: 5px; background: orange url('hiking.jpg') no-repeat; } #wildlife {border: solid #FA9928 1px; -moz-border-radius: 10px; -webkit-border-radius: 10px; width: 200px; height: 160px; padding: 5px; margin-top: 5px; background: orange url('wildlife.jpg') no-repeat; } p.discription {font-size: 12px; text-indent: 20px; } </style> </head> <body> <div id="limiter"> <ul id="ul_top"> <li><a class="mini_link" href="#">Contact us</a></li> <li><a class="mini_link" href="#">Area Map</a></li> <li><a class="mini_link" href="#">About us</a></li> </ul> <div id="container"> <div id="header"> <p class="company_name">Red<p class="company_name">Rock</p><p class="company_name">Recreation</p> </div> <div id="main_content"> <div id="text_holder"> <h1>Red Rock Canyon Las Vegas NV:</h1><p class="discription"> Red Rock Canyon, located just a few miles west of Las Vegas, is named for the deep red 3,000-foot-high sandstone cliffs that are perched above the dusty wastelands of this part of the Mojave Desert. The view from any part of the park is breathtaking: mostly nature fills the view, but from some points you can make out the entire Las Vegas Strip in the distance!</p><p class="discription"> Climbing, hiking, and bicycling throughout the park is fun and exiting for the whole family. In the summer time water, sunscreen, and proper equipment is necessary. Elderly and young children can opt to drive around the park (a small fee for motorized vehicles aplies) along a 13-mile paved loop and still experience the scenic views.</p><p class="discription"> A visitor's center provides information on area history, geology, flora and fauna (visitors may encounter burros, big horn sheep or desert tortoises). You can also pick up a map of the park with detailed hiking routes (beginner, intermediate, and advanced levels). Rangers offer guided tours at no charge -- see website for schedules.</p> </div> <div style="width: 100px;"><p class="company_name">Red<p class="company_name">Rock</p><p class="company_name">Recreation</p></div> <div id="recreation"> <div style="text-align:center;"><a class="rec_links" href="#">Climbing</a><br /> <div id="climbing"> <a href="#" class="pic_links"></a> </div> </div> <div style="text-align:center;"><a class="rec_links" href="#">Bicycling</a><br /> <div id="bicycling"> <a href="#" class="pic_links"></a> </div> </div> <div style="text-align:center;"><a class="rec_links" href="#">Hiking</a><br /> <div id="hiking"> <a href="#" class="pic_links"></a> </div> </div> <div style="text-align:center;"><a class="rec_links" href="#">Wildlife</a><br /> <div id="wildlife"> <a href="#" class="pic_links"></a> </div> </div> </div> </div> </div> </body> </html> Hi everyone, I am bad at this bit and i don't really know why. I have a div and a floated UL. I want the div to sit next to the UL, however, it sits above it and I cannot get them to sit together. Could someone please just post a brief method of getting them to sit side by side and I will try and work it for myself. Thanks. Page is http://www.wellandpower.net I have been trying in vain to get div elements on a page to behave how i want them to. I have a list of items, in the middle of which i need to display some tablular information witha picture along side it. This i have managed to acieve fine, but i can't get the next <li> to start below these 2, it starts alongside and the wraps underneath. I have tried everything. Can anyone help? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- #wrapper{ font-family:Verdana, Arial, Helvetica, sans-serif; margin-left: 20px; width: 550px; font-size: 12px; line-height: 22px; letter-spacing: 0.5px; color: #666666; } #topimg { margin: 20px 0; padding-bottom: 20px; border-bottom: 1px dotted #CCCCCC; text-align:left; display:block; } #secondimg { margin: 0 0 0 20px; text-align:left; display:block; } #bodyimg{ padding: 20px 0px 20px 20px; float:left; display:block; } #listtable{ padding-top: 20px; padding-bottom: 20px; float:left; font-size: 10px; letter-spacing: 0.5px; color: #891C46; list-style-type: none; line-height:18px; } #listtable li{ margin: 1px; padding: 1px; } #listtable div { margin: 1px; padding: 1px; background-color: #F7F7F7; } --> </style> <title>Carlton</title> </head> <body> <div id="wrapper"> <div id="topimg"> <img src="/carlton-newsite/img/planandbuy/planandbuy.gif" width="173" height="33"> </div> <div id="secondimg"> <img src="/carlton-newsite/img/planandbuy/thebasics.gif" width="133" height="23"> </div> <ul> <li>Cinema Advertising is available in weekly blocks starting on Fridays.</li> <li>It is possible to buy <em> guaranteed admissions</em> by TV region, <em> follow specific films</em> or <em> nominate individual screens</em>. </li> <li>The minimum time unit available is 5 seconds. Prices differ based on commercial length with indeces using 30” as a base: </li> <div id="listtable"> <table width="200" border="0" cellspacing="0" cellpadding="0" class="nobullet"> <tr> <td width="105"> <li> <div>5”</div> </li> <li>10”</li> <li> <div>20”</div> </li> <li>30”</li> <li> <div>40”</div> </li> <li>45”</li> <li> <div>50”</div> </li> <li>60”</li> <li> <div>90”</div> </li> </td> <td width="95"> <li> <div>.3”</div> </li> <li>.5”</li> <li> <div>.8”</div> </li> <li>.1.00”</li> <li> <div>.1.33”</div> </li> <li>.1.50”</li> <li> <div>.1.67”</div> </li> <li>.2.00”</li> <li> <div>.3.00”</div> </li> </td> </tr> </table> </div> <div id="bodyimg"> <img src="/carlton-newsite/img/digital_adver/satelite.jpg" width="220" height="182"> </div> <li>Cinema commercials are shown on 35mm film, it is easy to get your TV ad transferred by our production department. </li> <li>Lead times from booking to getting on screen are 3 weeks, although CSA’s <em> Early Booking Incentive</em> guarantees extra value if you can book your campaign 6 weeks in advance of start date. </li> <li>Cinema Advertising Association <em> cinema buying guidelines</em> ensure your campaign meets industry agreed standards. </li> </ul> </div> </body> </html> 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. Hi all, Im hoping someone out there can help me. Ive just discovered ive made a massive mistake by designing my site and viewing it in IE. It looks fine in IE, but of course there is one part that looks terrible in FF ( not FFs fault i know!) The navigation bar is an inline list that is supposed to appear tabbed but in FF one of the tabs is pushed up a lot higher and I cant figure out what is pushing it up. i thought it might be the #ul secondary pushing it up (as this appears a bit wonky as well...)and i tried adding /* Hides from IE-mac \*/ #ul secondary { position: absolute; margin: 0; padding: 0; bottom: -41px; left: 1px; width: 100%; } /* End hide from IE-mac */ but this didnt change anything. i tried using the DOM inspector that comes with firebug but I still cant figure out whats pushing up the one home page tab.... Any tips anyone might have would be greatly appreciated. My style sheets is /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* 2 column container ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #content-container-two-column { margin-top:3px; margin-left:auto; margin-right:auto; padding:10px; width:728px; position:relative; margin-bottom: 50px; } #content-main-two-column { width:728px; float:left; } #content-side-two-column { float:right; width:160px; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* 3 column container ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #content-container-three-column { margin-top:3px; margin-left:auto; margin-right:auto; padding:10px; width:728px; position:relative; } #content-main-three-column { width:355px; float:left; margin-left:25px; } #items-left { width:148px; float:left; margin-right: 45px; } #items-right { width:148px; float:right; margin-right: 45px; } #content-side2-three-column, #content-side1-three-column { width:150px; font-size:1.1em; } #content-side2-three-column { float:right; } #content-side1-three-column { float:left; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* index page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #three-column-container { background:url(../../images/bg-three-column-home.png) repeat-y; padding:0; margin:20px 0 10px 0; } #three-column-side1 { float:left; width:148px; margin-right: 45px; } #three-column-side2 { float:right; width:142px; background-color: #E9E9E9; padding-left: 2px; padding-right: 2px; } .centre { background-position: center; margin-bottom: 5px; text-align: center; padding: 0px; } #three-column-side22 { float:right; width:148px; } #three-column-middle { width:340px; margin:0px 10% 0px20%; margin-right: 10%; margin-left: 20px; } #three-column-middle-air { width:340px; margin:0px 10% 0px20%; margin-right: 10%; margin-left: 20px; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ body { margin:0px; background-color:#FFFFFF; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.7em; line-height:1.4em; color:#666666; } p { margin:10px 0; } p.no-padding-no-margin { padding:0; margin:0; } hr{ color: #E5E5E5; background-color: #E5E5E5; height: 1px; border:0; margin:15px 0; _margin:10px 0; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* headings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ h1, h2, h3, h4, h5, h6 { font-size:1.8em; font-family:Verdana, Arial, Helvetica, sans-serif; line-height:1.1em; margin:5px 0; } h1 { margin-bottom:0; } h1, h2 { margin-top:0px; } h2 { font-size:1.3em; } h3 { font-size:1.1em; } h3.small { font-size:1.2em; } h4 { font-size:1.1em; } h5 { font-size:1.1em; } h6 { font-size:1em; } a:link { color:#d61719; text-decoration:none; } a:visited { color:#980000; text-decoration:none; } a:hover { text-decoration:none; } a:active { color:#980000; } #content-side-two-column a:link, #content-side2-three-column a:link, #content-side1-three-column a:link, #content-side-two-column a:visited, #content-side2-three-column a:visited, #content-side1-three-column a:visited { text-decoration:none; } #content-side-two-column a:hover, #content-side2-three-column a:hover, #content-side1-three-column a:hover { text-decoration:underline; } .img_text { float:left; margin-top:0px; margin-right:10px; margin-bottom:0px; } #poster-photo-container { margin-left:auto; margin-right:auto; width:750px; position:relative; } .poster-photo-image { display:block; } ul { margin:0; padding:0; list-style:none; } li { list-style:none; background:url(../../images/list-bullet-02.gif) no-repeat 0 .8em; padding:.2em 0 .2em 1em; margin-left:0.4em; } #content-side1-three-column ul.list-of-links, #content-side2-three-column ul.list-of-links { margin: 0 0 30px 0px; } ul.list-of-links li{ background-image:url(../../images/list-bullet-01-link.gif); } ul.list-of-links li.current { background-color:#E5E5E5; } ul.no-lines, ul.no-lines li { border:none; } .feature-area { background-color:#6799D1; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* images ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ img { border:none; } .img_footer { border:none; padding-right:10px; } .photo-border { padding:0px; margin-bottom:5px; display:block; /*background-image: url(../../images/bg-photo.png); background-repeat: repeat-x; background-position: top;*/ } .photo-float-left { float:left; margin-left:0px; margin-right:10px; margin-top:0px; margin-bottom:40px; } .photo-float-details { float:left; margin-left:0px; margin-right:10px; margin-top:0px; margin-bottom:1px; } .image-border-none { border:none; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* FOOTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #footer { margin-top:3px; margin-left:auto; margin-right:auto; width:740px; padding:.8em 0 1em 10px; position:relative; font-size:0.9em; text-align: center; } #footer a:link, #footer a:visited { color:#555450; text-decoration:none; padding:0px 0px 0px 10px; } #footer a:hover { color:#64645c; text-decoration:none; padding:0px 0px 0px 10px; } #footer a:active { color:#FFFFFF; padding:0px 0px 0px 10px; } .arrow { vertical-align:middle; } .clear { clear:both; } .none { display:none; } .dent { margin-left: 20px; } /*Tabs*/ html, body { margin: 0px; padding: 0px; } body { text-align: left; } #Wrapper { font-family: Georgia, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; text-align: left; width: 750px; margin-top: 20px; margin-right: auto; margin-bottom: 0px; margin-left: auto; padding: 0px; } #Container { background-color: #FFFFFF; color: #333; clear: both; margin: 0px; padding-top: 2.2em; padding-right: 0; padding-bottom: 0; padding-left: 0; width: 750px; float: left; border-top: 1px solid #C0C0C0; display: block; } #Content { background-color: #FFFFFF; border-top-width: 1px; border-top-style: solid; border-top-color: #C0C0C0; padding-bottom: 20px; margin: 0px; width: auto; height: auto; } #Navigation { margin: 0px; padding: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight:bold; color: #333333; position: relative; height: 50px; display: block; width: auto; } ul#primary { margin: 0; padding: 0; position: absolute; bottom: -1px; width: 728px; } ul#primary li { display: inline; list-style: none; } ul#primary a,ul#primary a.active { width: 10em; display: block; float: left; text-align: center; font-family: tahoma, verdana, sans-serif; font-size: 12px; text-decoration: none; color: #333; letter-spacing: .1em; margin-top: 0px; margin-right: 2px; margin-bottom: 0; margin-left: 0; padding-top: 4px; padding-right: 0; padding-bottom: 4px; padding-left: 0; } ul#primary a.active,ul#primary a.active:hover { border-top: 1px solid #c0c0c0; border-right: 1px solid #c0c0c0; border-bottom: none; border-left: 1px solid #c0c0c0; background: #ffffff; color: #333; margin-top: 0; margin-right: 2px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 0px; padding-bottom: 4px; padding-left: 0px; } ul#primary a { border-top: 1px solid #c0c0c0; border-right: 1px solid #c0c0c0; border-bottom: none; border-left: 1px solid #c0c0c0; margin-top: 0px; margin-right: 2px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; background: #e8e9e1; } ul#primary a:hover { margin-top: 1; border-color: #c0c0c0; color: #333; padding-bottom: 3px; margin-right: 2px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 0px; padding-left: 0px; background: #e9eaea; } ul#secondary { position: absolute; margin: 0; padding: 0; bottom: -21px; left: 1px; width: 100%; } /* Hides from IE-mac \*/ #ul secondary { position: absolute; margin: 0; padding: 0; bottom: -41px; left: 1px; width: 100%; } /* End hide from IE-mac */ ul#secondary li a { width: auto; display: block; float: left; padding: 0 10px; margin: 0; text-align: center; border-top: none; border-right:none; border-bottom: none; border-left: none; background: none; color: #666; background-color: #FFFFFF; text-decoration: none; } /* Hides from IE-mac \*/ #ul secondary li a { width: auto; display: inline; float: left; padding: 0 10px; margin: 0; text-align: center; border-top: none; border-right:none; border-bottom: none; border-left: none; background: none; color: #666; background-color: #FFFFFF; text-decoration: none; } /* End hide from IE-mac */ ul#secondary li a:hover { color: #333; border-top: none; border-bottom: none; border-left: none; margin: 0px; padding-top: 0; padding-right: 10px; padding-bottom: 0; padding-left: 10px; background: none; } ul#secondary li a:active { color: #000; font-weight: bold; } ul#secondary li:last-child a { border: none; } .bold { font-weight:bolder; color:#000000;} #number { width:20opx; } And some of the html <div id="Wrapper"> <img src="pics/logo2.gif" align="right" /> <div id="Navigation"> <ul id="primary"> <li><a href="index.html" class="active">Home</a></li> <li><a href="print.html">Printing</a> <ul id="secondary"> <li><a href="about.html">About us</a></li> <li><a href="environment.html">Environment</a></li> <li><a href="links.html">Links</a></li> </ul> </li> <li><a href="products.html">Products</a></li> <li><a href="cart">View Cart</a> <li><a href="contact.html">Contact us</a></li> </ul> </div> <div id="Container"> <div id="Content"> <div id="poster-photo-container"><img src="pics/header6.jpg" alt="" class="poster-photo-image" /></div> <div id="content-container-two-column"> <div id="content-main-two-column"> <h1> Welcome to The Picture Works Printing Room</h1> Ok, i have this menu with links, but i have a few problems. 1) Don't know why, but i can't center the menu links. There is more space from left to the menu, than from the right to the end of the menu. 2) I'd like to change the properties of each link (using CSS) individually, so i can resize each one like i want. I've done it, but it nly worked in IE. here's the site PS: I still haven't converted pictures to .gif, so it takes a little bit to load all pictures (3). I'm having trouble understanding how to vertically center an inline list in a div. Can anyone recommend some reading? The list is used for a horizontal nav bar with a background. I've set the height of the div to 20px because that's the height of the bg image. Also: Should the font specs be where they are (#nav ul) or maybe in the #nav section? Here's the code: Code: #nav { background: url(../images/nav_bg2.gif); text-align: center; overflow: hidden; height: 20px; } #nav ul{ margin:0; padding:0; list-style:none; } #nav li{ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 0.75em; display:inline; margin:0; padding:0; } Damn another problem good thing you guys are so helpful.... What am I doing wrong here? css Code: #footer{ position:relative; z-index:-1; margin-top:-50px; background-color:#666666; width:100%; height:100px; margin-left:auto; margin-right:auto; border-top:#000000 10px solid; } #footer ul{ position:absolute; padding:0px; margin-top:50px; margin-left:auto; margin-right:auto; } #footer li{ display:inline; padding:0px; margin:0px; } #footer a{ font-family:Arial, Helvetica, sans-serif; font-size:10px; border-right:#FFFFFF 1px solid; } html Code: <div id="footer"> <ul> <li><a href="#">Nav 1</a></li> <li><a href="#">Nav 2</a></li> <li><a href="#">Nav 3</a></li> <li><a href="#">Nav 4</a></li> <li><a href="#">Nav 5</a></li> <li><a href="#">Nav 6</a></li> <li><a href="#">Nav 7</a></li> </ul> </div> Just can't seem to get the list centered inside the div As the title says... Design constraints unfortunately mean I need to do achieve the basic design shown in the example below (using a list) I have created an example to illustrate the problem I am experiencing. Problem example The list item text is wrapping too early in IE6 and IE7, though fine in my other target browsers such as Firefox and Opera. removing clear:left stops the wrapping, but then when 2 or more nav items have short content they sit on the same line which is no good obviously Any ideas / solutions etc. would be most welcome I have the following list that I want displayed horizontally. I chose to do it with display:inline instead of float:left as that seemed to be the only way to get it to center on the page: http://www.jimandkris.com/listtest.html However, now I can't figure out how to get those submenus to align under their respective parent. Hopefully this is an easy one, any suggestions? Hello, I was wondering if anyone could shed some light on this problem I'm having with my navigation bar. I've Googled and tried every [seemingly] logical combination, but can't get it to work -- and it's driving me nuts! Basically, I have a div containing an unordered list and an image. The image is a non-semantic hack I've had to put in for the design, without making it massively complicated... Anyway, the problem is with the ul, which contains lis that are just images (tabs). Like so: Code: <div id="tabs"> <ul> <li><a href="..."><img src="..."></a></li> <li><a href="..."><img src="..."></a></li> [etc.] </ul> <img src="filler.png"> </div> Each image is a different width; and the above is simplified for clarity... Anyway, this works perfectly in Firefox, Opera and even IE. However, in Safari and Chrome, the lis have a few extra, blank pixels of padding on the right edge of the image; whereas I want all the images to butt-up against each other. My CSS is as follows: Code: #tabs { word-spacing: -4px; } #tabs ul { display: inline; list-style: none; margin: 0px; padding: 0px; } #tabs li { display: inline; } The word-spacing for the div removes the spacing you automatically get in Firefox/Opera/IE -- I found -4px was enough to remove the gap entirely -- but in Safari/Chrome, a gap remains. If you make the value even smaller (e.g. -5px, -60px, etc.) it makes no difference in any browser; if you make it bigger, then the gaps widen in all browsers. However, WebKit browsers always have that extra padding on the right edge. Any ideas on how to get rid of this?... I've tried "display: inline-block", "-webkit-border-horizontal-spacing" with various values, "white-space: nowrap"; even altering the HTML so that the images and lis have explicitly defined widths. Nothing works! Hi, Below is part of my code. Sorry could not upload everything otherwise code would look cumbersome, also could not load images but each image is 234 X 110. What I have is a left column. I firstly want to place a list and then three divs, each div containing an image (with text), that is also a link. I assumed with normal flow the list would appear first and then the divs, one after another. For some reason the divs go to the top of the column and are hidden by the list. I want a normal flow so that the list appears first and then the divs. Any suggestions? I would be grateful for all help. 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> <title>Test Page</title> <style type="text/css"> h1, h2, h3, h4, h5, h6, p{ margin:0; padding:0 } img { border:none } a{color:#000;text-decoration:none} a:hover { text-decoration: underline; } body { color:#000; font-family:Verdana, Geneva, sans-serif; } #wrap { min-width: 71.08em; margin:auto; overflow:hidden; } #left { width: 17.38em; padding: 0; border: 0.125em solid #FF0000; } #left.column { text-align: justify; } #left ul { margin: 0; padding: 0; } #left ul li { list-style-type: none; } #left ul li a, #left ul li a.first_in_list { float: left; display: block; width: 16em; margin-left: 0.4em; padding: 0.28em 0 0.28em 0.25em; background-color: #FFD700; border-top: 1px dotted #FFFFFF; font-family: arial, verdana, sans-serif; font-size: 1em; font-weight: normal; color: #000000; } #left ul li a:hover { text-decoration: none; } #left ul li a:hover span { text-decoration: underline; } #left ul li a.first_in_list { width: 16em; font-size: 1em; font-weight: bold; margin-top: 1.8em; padding: 0.8em 0 0.8em 0.25em; border-top: none; } #leftVLink, #leftSLink, #leftGLink { text-align: right; border: none; margin: 0.3em 0 0 1em; } #leftVLink a:link,#leftSLink a:link,#leftGLink a:link { color: #333; width: 15em; height: 7em; display: block; font-size: 0.95em; font-family: Verdana; } #leftVLink a:hover,#leftSLink a:hover,#leftGLink a:hover { color: #000; text-decoration: underline; } #leftVLink { min-width: 14em; background: #fff url(leftVLink1.gif) no-repeat left top; margin: 1.5em 0 0 1em; padding: 0.6em 0.5em 0 0; } #leftSLink { background: #fff url(leftSLink1.gif) no-repeat left top; padding: 0.6em 0.5em 0 0; } #leftGLink { background: #fff url(leftGLink1.gif) no-repeat left top; padding: 1.4em 0.5em 0 0; } </style> </head> <body> <div id="wrap"> <div id="left" class="column"> <ul> <li><a class="first_in_list" href="#"> Shopping Directory</a></li> <li><a href="#">► <span>Latest</span></a></li> <li><a href="#">► <span>Phone Finder</span></a></li> <li><a href="#">► <span>iPhone finder</span></a></li> <li><a href="#">► <span>Deal Finder</span></a></li> <li><a href="#">► <span>Phones + FREE gifts</span></a></li> <li><a href="#">► <span>Shop by brand</span></a></li> <li><a href="#">► <span>Sim free phones</span></a></li> <li><a href="#">► <span>Coming soon</span></a></li> <li><a href="#">► <span>New and exclusive</span></a></li> <li><a href="#">► <span>Trade in</span></a></li> <li><a href="#">► <span>Compare phones</span></a></li> <li><a href="#">► <span>Mobile services</span></a></li> </ul> <div id="leftVLink"><a href="#" title="voucher codes and offers">Voucher codes<br />and offers</a></div> <div id="leftGLink"><a href="#" title="gift ideas: be inspired by our gift ideas">Be inspired by<br />our gift ideas</a></div> <div id="leftSLink"><a href="#" title="safe shopping: advice for safe shopping">Advice for<br />safe shopping</a></div> </div> </div> </body> </html> In my style-sheet, I have something like this #mainnav UL LI { height:50px; vertical-align: middle; (i tried center also) text-align: center; } What I want the text to sit half-way down the 50 height... Isn't there an automatic way (w/o javascript) to change the class of a menu item if they're on the selected page? I could have sworn there was an easy way to make a menu item highlight if the user was on that page..... But then again, maybe im nuts... Thanks. http://www.rodoslovlje.com/ Use IE e.g. Does anyone know how I can fix this. Thnx Take a look at this page http://www.gameworldx.com/test.html I removed most of the html exept the part giving me problems, but all of the CSS is there. You will see a blue bar(footer) and the white bar (bottom). Both of the links are blue and bold. Why? I have no idea. That is the problem. I noticed that is I remove the CSS for one div or the other, the opposite div shows correctly, but I dont know why it does that. Can anyone see any problems? It's really late, and I am tired, so its gotta be a really stupid mistake. Thanks! Please visit this page - http://www.tmhdesign3.com/real-estate-broker.asp See the gap, about 10px, on the page just below the header? For the life of me I can't get rid of it in FF. I opened Firebug and specified a top:-10px on the content div and it closes the gap. BUT, when I open my css file on the server and chagne that spec and then open the page I still have the gap??? Thanks for any help. If it works in Netscape, it will not work in IE If it works in IE, it will not work in Netscape. Soo, what am I to do? Okay, Im trying to make a table bg have an opacity of 40%. I've gone over the net to figure out the problems, knowing that filter:alpha{} is not recognized by Netscape. So, I found some information to help overcome Netscape woes, and now the opacity isn't work in IE. I need help before I rip all my hair out. So below is what Im working with. Code: <html> <head> <style type="text/css"> #menu { background-color: #FFFFFF; filter: alpha(opacity=40); filter: progid;:DXImageTransform.Microsoft.Alpha(opacity=40); -moz-opacity: 0.40; position:relative; top:0; } .tdbg { background-color: #FFFFFF; filter: Alpha(Opacity=40); } </style> </head> <body> <table width="610" border="0" cellpadding="5" cellspacing="0" bgcolor="#FF0000"> <tr> <td align="center"> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="tdbg">FOO</td> </tr> <tr> <td> </td> </tr> <tr> <td><div id="menu">FOO</div></td> </tr> </table></td> </tr> </table> </body> </html> So, basically the top cell is "correct" in IE, but the bottom cel is not. And opposite for Netscape (7.0+) How can i fix it so its the same for both browsers? |