CSS - Adding A Float Image To A Ul. Nn, Opera Display Issue.
I'm including some images within a UL. I've coded them in there to float. IE displays the list as I want but NN and Opera won't play along. In fact they both "get it wrong" in different ways. What am I doing wrong? (as you can see it is for a course and it is important to me to get it right not just good enough).
Here's the address. The CSS coding is on the actual page for easy viewing. link Similar TutorialsHi there, I'm trying to get the background image to repeat down the page, but I think the float is messing it up since it's outside the element, or something like that. The background image call works fine, you can test it if you enlarge the #Middle height values. http://www.wpforrealestate.com/prod...es/Design2/www/ I've had this problem before, but figured it out through the help here and some links on floats, but this time I'm just not getting it for some reason. Any ideas? Thanks. Say I have the code: Code: <div style="float: left">left</div> <div style="float: right">right</div> In Opera, Firefox and IE, "left" will be on the left side of the scren, "right" will be on the far right. Now let's say I nest those two in a parent. I want the parent to expand with the child's content, so I float it too: Code: <div style="float: left;"> <div style="float: left">left</div> <div style="float: right">right</div> </div> In Firefox in IE, "left" is still on the far left and "right" on the far right. In Opera, it collapses the div so they're right next to each other, or "leftright". Now I could set a width of 100% on the parent, but the situation I'm actually using something like this in is more complicated -- padding, margins, etc. So setting a width of 100% makes the parent overflow it's parent nodes. I've tried not floating the parent and setting it to overflow: auto, but that doesn't seem to work either. Is there an easy fix I'm missing? Hi all, I'm currently working on converting a table based site to a CSS table less one. I have a fairly good understanding of CSS, but have come across a problem and would like some help in sorting it out if possible. The code I am pasting here is a quick mock up of what I am trying to acheive. It is a 2 column page, with a header and footer. When I run this code in IE 6, it seems to work as I think it should. When I run it in Opera 9, the maincenter content seems to move to the top of the last float in left column. I assume that my css code is wrong or my understanding is wrong, or there is some quirk, hack etc that I should be using. 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> <!--Don't add anything above this line, you may change the DTD to match your page--> <title>Test Page</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <div id="header">This is the header</div> <div id="main"> <div id="mainleft">stuff on the left<br /> more stuff on the left</div> <div id="mainleft1">stuff on the left<br /> more stuff on the left</div> <div id="mainleft2">stuff on the left<br /> more stuff on the left </div> <div id="mainleft3">stuff on the left<br /> more stuff on the left</div> <div id="mainleft4">stuff on the left<br /> more stuff on the left</div> <div id="mainleft5">stuff on the left<br /> more stuff on the left</div> <div id="maincenter">stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /> stuff on the right<br /></div> <div class="clear"></div> </div> <div id="footer">This is the footer</div> </div> </body> </html> CSS: Code: #container { width: 600px; text-align: center; margin: 20px auto 0 auto; } #header { width: 598px; margin: 0px 0px 0px 0px; border: solid 1px; } #main { margin: 20px 0px 0px 0px; border: solid 1px; float: left; width: 598px; overflow: auto; } #mainleft { margin: 5px 5px 5px 5px; float: left; width: 150px; border: solid 1px; display: inline; clear: left; } #mainleft1 { margin: 5px 5px 5px 5px; float: left; width: 150px; border: solid 1px; display: inline; clear: left; } #mainleft2 { margin: 5px 5px 5px 5px; float: left; width: 150px; border: solid 1px; display: inline; clear: left; } #mainleft3 { margin: 5px 5px 5px 5px; float: left; width: 150px; border: solid 1px; display: inline; clear: left; } #mainleft4 { margin: 5px 5px 5px 5px; float: left; width: 150px; border: solid 1px; display: inline; clear: left; } #mainleft5 { margin: 5px 5px 5px 5px; float: left; width: 150px; border: solid 1px; display: inline; clear: left; } #maincenter { float: left; display: inline; margin: 5px 5px 5px 5px; border: solid 1px; width: 424px; } .clear { clear: both; } #footer { margin: 20px 0px 0px 0px; border: solid 1px; width: 598px; } Some notes: 1. Originally I had the left hand stuff in a div called mainleft, but had trouble getting that to work. Would that be correct, to include all the code in one div, with smaller divs inside it? 2. The little boxes on the left will be different boxes on the page, but for the mockup they are all the same, with different ids. 3. After looking around, I found out about the overflow: auto; for inside the main div, which fixed a nice problem I was having (main not having any content bar floats). Is IE 6 displaying the code right, or is Opera 9? --> I just had a bit of play around before posting and if I add a div around all the mainlefts, the code seems to work in both IE 6 and Opera. So whould that be best, to stick with that? I think adding in the overflow:auto; fixed the problem I was having with that earlier. Would still apreciate any comments Many thanks Scott Hello ppl, I have a problem about 6 div's which are displayed inline. Everything is OK in Opera and IE but in firefox everything is wrong .. all the divs are almoust in the same place , one over another here is the link http://www.immo-land.ro/test/div-inline.html and below is the code which I wrote for every DIV Code: <div style="border: 1px solid #c5732a; width: 164px; height: 150px; padding: 95 0 0 0; margin: 3px 3px 3px 3px; display: inline; background-image: url(../images/immo-land-apartamente-garsoniere.jpg); background-repeat: no-repeat"> <a href="http://localhost/immoland/vanzare-apartamente.php" style="background: #C5732A; width: 100%;">Apartamente</a> <br> Text here </div> any ideea why is all that mess in firefox ? 10x in advance See ya all here is the site http://142.177.157.241:8080/bikers/ Well, I have some work to do about opera and IE since they are slow in the browsers making or the standards compliance. Even Opera8 doesn't suport my site and I think that was just released not too long ago. I think I'm going to be changing my browser of choice from Firefox to Netscape 8. I have the beta right now and it looks awesome and has all the functionality of Firefox I want plus it makes it easy to change between IE and netscape without actualy going to IE to see how my site looks. Two birds with one stone. I'm trying to get my show/hide script working in Opera 6 and having no luck. So I know I can set CSS properties with JavaScript in Opera 6 (I'm testing on Mac) as I've managed to make it work with the visibility property. However doing: Code: document.getElementById(el).style.display = 'block'; does nothing... if I do an alert on the display setting of the element it always says undefined. I've also tried doing a className switch, but doing this : Code: <div id="el" class="hidden">...</div> alert(document.getElementById(el).className); Also gives me a 'undefined' message. Opera 6 is the only thing that's playing up on me at the moment so any help would be greatly appreciated. -D Theres a small spacing issue thats only coming up in opera for the navigation on this site. It seems to be only 1px, but I cant for the life of me find out where its coming from. The hover background doesn't extend all the way down, as it does in firefox/ie. I think its some issue with top:32px; in nav ul li, but I don't know what the solution is. Any help is appreciated. Demo link at www.ryancolantuono.com/test Code: body { font-family: "Lucida Grande","Arial Unicode MS", sans-serif; margin: 0; padding: 0; } #content { color: #555; margin: auto; width: 780px; } /* ----------------------- HEADER ----------------------- */ #top-header { background-color: #000; height: 20px; color: #eee; border-bottom: #555 solid 1px; } #top-header .login { float: right; margin: 5px 10px 0 0; font-size: .7em; } #top-header .login a{ text-decoration: none; color: #70d5d4; } #mid-header { background: #222 url("../images/mid-header.png"); height: 55px; } #bot-header { background: #4eaead url("../images/bot-header.png") repeat-x; height: 105px; } /* ----------------------- END HEADER ----------------------- */ /* ----------------------- NAVIGATION ----------------------- */ #nav { float: left; margin: 0 15px 0 0; } #nav ul { margin: 0; padding: 0 70px 0 0; display: block; list-style: none; } #nav ul li { top: 32px; display: inline; position: relative; clear: both; } #nav ul li a { font-size: .8em; color: #fff; text-decoration: none; padding: 3px 12px 3px 12px; } #nav ul li a:hover { background-color: 70d5d4; color: #000; -moz-border-radius: 3px; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; padding: 5px 12px 5px 12px; } /* ----------------------- END NAVIGATION ----------------------- */ Code: <html> <head> <title>test</title> <link rel="stylesheet" type="text/css" href="css/main.css" media="screen"/> </head> <body> <div id="top-header"> <div class="login">Have an account? Login <a href="#">here</a>.</div> </div> <div id="mid-header"> <div id="nav"> <ul> <li><a href="#">Home</a> <li><a href="#">About Us</a> <li><a href="#">Portfolio</a> <li><a href="#">Links</a> <li><a href="#">Contact</a> </ul> </div> </div> <div id="bot-header"></div> </body> </html> Hey, I got a webpage that looks like it should in both IE 6.0 and firefox 2.0. Now i went testing it in opera and it has a problem with some div positions. Here is how it looks in firefox and IE: Internet explorer:http://img442.imageshack.us/img442/8176/iexz2.jpg firefox:http://img361.imageshack.us/img361/5503/firefoxqc0.jpg And this is how it looks in Opera 9.10:http://img442.imageshack.us/img442/5125/operauw7.jpg The buttons signout, new contact and contact list are shifted to the low. I use this code on every page do display the header with the buttons ( the red part is the div with the buttons in it. Code: <body> <div class="containingTitles"> <div class="titleNavDiv"> <b>Hello, stefan.</b> </div> <div class="titleContentDiv"> <form action="search_contact.php" name="search" id="search" method="get"> <div style="float: left; width: 35%; margin: 0%; padding: 0%;"> <input type="text" style="width: 50%" name="sq" value="" id="sq"> <input type="submit" name="s" value="Search" id="s"> </div> </form> <form name="new_contact" id="new_contact" method="get" action="new_contact.php"> <div style="float: left; width: 22%; margin: 0%; padding: 0%; text-align: right;"> <input type="submit" name="nc" value="New Contact" id="nc"> </div> </form> <form name="contact_list" id="contact_list" method="get" action="contact_list.php"> <div style="float: left; width: 22%; margin: 0%; padding: 0%;"> <input type="submit" name="cl" value="Contact List" id="cl"> </div> </form> <form name="logout" id="logout" method="get" action="logout.php"> <div style="float: left; width: 20%; margin: 0%; padding: 0%; text-align: right;"> <input type="submit" name="lo" id="lo" value="Sign out"> </div> </form> </div> </div> <div class="navigationDiv"> <div class="unselectedContact"><a href="contact_info.php?contact_id=102">Username1</a></div> <div class="unselectedContact"><a href="contact_info.php?contact_id=102">Username2</a></div> <div class="selectedContact"><a href="contact_info.php?contact_id=102">Username3</a></div> etc. </div> <div class="contentDiv"> ----- contents of the page ----- </div> </div> And belowis the css code i use to float the divs into position. And here you can see the division of the pages and which class belongs to which div: http://img353.imageshack.us/img353/1503/layoutai3.jpg css Code: Original - css Code body{ margin: 0; padding-left: 0%; padding-right: 0%; padding-top: 0%; padding-bottom: 0%; background: url(background.jpg) 22% 0; } .containingTitles{ float: left; width: 100%; margin: 0%; padding: 0%; background-color: #4D3D4D; color: white; overflow: hidden; } .titleNavDiv{ float: left; width: 20%; margin: 0%; padding-left: 2%; padding-right: 0%; padding-top: 1%; padding-bottom: 1%; overflow: hidden; } .titleContentDiv{ float: left; width: 77%; margin: 0; padding-left: 0%; padding-right: 0%; padding-top: 1%; padding-bottom: 1%; overflow: hidden; } .navigationDiv{ float: left; width: 22%; margin: 0; padding-left: 0%; padding-right: 0%; padding-top: 0%; padding-bottom: 0%; overflow: hidden; color: #FFFFFF; background-color: #4D3D4D; } .contentDiv{ float: left; width: 76%; margin: 0; padding-left: 2%; padding-right: 0%; padding-top: 0%; padding-bottom: 0%; overflow: hidden; color: #000000; background-color: #BFACBF; }
hope you can tell me why this happens. Thanks in advance. OK, So I have put together what I thought was a reasonably basic xhtml page outline. I'm using a Win2k box. I checked it in Opera 7 and IE6 and it looks fine (more or less). I've also validated the xhtml and css codes. However, when I look at the page in Netscape 7.1 or Firefox, the menu kind of hangs a bit in limbo. Otherwise the rest of the page render's fine. I've included my code below. Does anyone have any suggestions since it's likely that if it doesn't work in Netscape/Firefox, it won't work in many other browsers either. Thanks! Shawn PS I'm not saying there is anything wrong with Firefox/Netscape, but likely my code URL: http://www.raisetheratesottawa.org/xhtml/ ===== CSS ===== HTML { PADDING-RIGHT: 0px; MARGIN-TOP: 0px; PADDING-LEFT: 0px; BACKGROUND-COLOR: #FF99CC; MARGIN-BOTTOM: 20px; PADDING-BOTTOM: 0px; COLOR: #000000; PADDING-TOP: 0px } BODY { PADDING-RIGHT: 0px; MARGIN-TOP: 0px; PADDING-LEFT: 0px; BACKGROUND-COLOR: #FF99CC; MARGIN-BOTTOM: 20px; PADDING-BOTTOM: 0px; COLOR: #000000; PADDING-TOP: 0px } #upper { width:700px; margin:0px auto; text-align:left; padding: 0px; border: 5px solid #FFFFFF; BACKGROUND-COLOR: #000000; PADDING-RIGHT: 0px; MARGIN-TOP: 0px; PADDING-LEFT: 0px; MARGIN-BOTTOM: 10px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px } /* Horizontal nav */ #menu { width:700px; margin:0px auto; padding: 0; } #menu ul { border: 0; margin: 0; padding: 0; list-style-type: none; text-align: center; clear: left; } #menu ul li { display: block; float: left; text-align: center; padding: 0; margin: 0; } #menu ul li a { background: #000000; width: 175px; /* was 'height: 2em; */ height: 24px; padding: 0; /* was 'margin: 0 0 10px 0; ' this affects the margin between upper menus*/ margin: 0 0 0 0; color: #FF0000; text-decoration: none; display: block; text-align: center; font-weight: bold; letter-spacing: 1px; /* was 'line-height: 2em; */ line-height: 24px; /* was 'font-size: x-small; ' */ font-size: 10px; font-size: 10px; /* was 'FONT: 8px Verdana, Arial, Helvetica, Sans-Serif;*/ } #menu ul li#one { width: 46px; } #menu ul li#two a { width: 154px; } #menu ul li#three a { width: 105px; } #menu ul li#four a { width: 85px; } #menu ul li#five a { width: 56px; } #menu ul li#six a { width: 57px; } #menu ul li#seven { width: 147px; } #menu ul li a:hover { color: #000000; background: #FF0000; } #menu a:active { background: #c60; color: #fff; } #content { width:700px; margin:0px auto; text-align:left; padding:0px; border:5px solid #FFFFFF; background: url(/xhtml/graph/rtr-logo-bk.gif) #FF99CC; } ====== XHTML ====== <!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"> <head> <title>Test</title> <link rel="stylesheet" href="graph/rtrcss2.css" type="text/css" /> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="ROBOTS" content="No Index" /> <meta name="Copyright" content="Copyright (c) 2004" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="help" href="about.php" title="Site info." /> <meta name="Rating" content="General" /> <meta name="revisit-after" content="2 Days" /> <meta name="doc-class" content="Living Document" /> </head> <body> <div id="upper"> <div id="header"> <img src="graph/top-right2.jpg" width="700" height="78" alt="" /> </div> <div id="menu"><ul> <li id="one"> </li> <li id="two"><a href="link1.php" title="Link 1.">Link 1</a></li> <li id="three"><a href="link2.php" title="Link 2.">Link 2</a></li> <li id="four"><a href="link3.php" title="Link 3.">Link 3</a></li> <li id="five"><a href="link4.php" title="Link 4.">Link 4</a></li> <li id="six"><a href="link5.php" title="Link 5.">Link 5</a></li> <li id="seven"> </li> </ul></div> </div> <div id="content"> <p>Here is some text</p> <p>Here is some more text </p> </div> </body> </html> Hello, Here is an example of the issue I'm having.. http://www.patricksaviation.com/backend.php In Firefox and IE, the border color is correct, but in Opera the color is just black; this is caused by applying border-collapse: collapse. I tried adding, in addition to to the standard html bordercolor, a CSS border-color, which helped change Opera to a dark green (not the right color, but closer) but it also causes the border color in IE to darken (the wrong color). Does anyone know what causes this or how I could fix it? Thanks, Patrick Is there a clean way to display an element right next to a floated div that will have a changing width? I have an element I'm floating left, with max-width set (using an IE hack for IE). What I want is for my right floated div to display immediately after the left floated one. It's displaying a headline and a date. The reason they are not in teh same container is that if the headline is rather long I'm letting the text wrap. Thanks! Hello i would like to know if there is any hacks or tips to resolve problem in IE6's rendering of Floated Boxes? It seems IE6 add extra padding or margin to some floated element, specially those near the borders of container... How do i get around this? Having one last problem before the site goes beta live... I have rounded divs, and inside is a floated left menu element. If something in the menu expands the round corners pop out of place rather then shift down. Im not sure what to chage. The site is: adventurevalley.ca/jason/programs/prgSwim.cfm If you mouse over the birthday parties link you will see what I mean (IE7 issue). Thanks a mill! hello. i am making a small, rough bar graph on the left side of my page. when i try it, the bar ends up going to a new line. what i'd like to do is have a colored div fill up 80% or 100% of the rest of the space to the right of the key. here is the code: Code: <div class="bar_graph"> <div class="key">signed: 8,000</div> <div class="bar signed" style="width: 80%"> </div> </div> ... .signatures { margin-top: 20px; } .signatures .bar_graph { overflow: auto; margin-top: 2px; } .signatures .key { float: left; font-size: 8px; text-align: right; width: 40px; } .signatures .bar { float: left; height: 17px; } .signatures .signed { background: #f3b400; } .signatures .goal { width: 100%; background: #e58728; } Hatchetradio.com/radio/ if you check this page it's fine in firefox if you check this page in I.E. the tab on the left hand side actually sits on top of the layout. I'm trying to get it to fit snug. I'm not sure why this is happening. hatchetradio.com/radio/wp-content/themes/reborn/style.css that's the css im using I have a section of 3 divs, 1 floated to the left, one to the right and one in the middle. IE 7 & Firefox are fine however in IE 6 it seems to display the left and right columns as a block pushing the middle column down to the bottom. see screenshot, the image is the middle div while the white side parts are the left and right columns. My code is as follows: CSS Code: Original - CSS Code #headerLeft { float: left; background-image: url('/media/images/040708_05.jpg'); background-repeat: no-repeat; width: 20px; height: 323px; } #headerRight { float: right; background-image: url('/media/images/040708_07.jpg'); background-repeat: no-repeat; width: 20px; height: 323px; } #flashMovie { background-color: #FFFFFF; margin-left: 20px; margin-right: 20px; width: 730px; }
Hi Guys, Ive got a serious'ish error on a site im responsible for and with it being the period between christmas and new years I cant find anyone to help me. So im coming asking for help with an IE6 error which is occuring on http://social.eyeforpharma.com/ It appears fine in every browser apart from IE6. IE7, FF, Safari etc work fine. With no decent debug tools for IE6 available im stuck. Help REALLY appreciated. Kevin. Edit - The error gets worse when you go to view an article. heys all, im having an issue with text that is variable length. i want to float something in the bottom right corner of some text. that something which is floated should have a width of 100px and height of 100px. so for example text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text FLOATED HERE text text text text text text text text text FLOATED HERE text text text text text text text text text FLOATED HERE now the sample text above can be 1 line, or 100 lines. anyone have any ideas? i've been hammering away at this too long Thanks. Thanks for taking the time to read my question. I have a <div></div> that I am using to make a bar across my page. In this bar I am placing the links to the other pages on the site. If I don't use float, the height is messed up. If I do use Float, the width shrinks to the minimum. So I added width: 100%; but that made it wider than the rest of the other bars I already have... at leasts in FF, but not in IE. What should I be using? Float? Block? Inline? I've read the descriptions on http://www.w3schools.com/css/pr_class_display.asp but am still unclear on how to use them. I would like to have an area as wide as the page, with links in it so that the height fits the text + the padding. Does DocType help this? Not to clear on how to use that either. Thanks again, Brad my code below. HTML: Code: <html> <!-- Generated by AceHTML Freeware http://freeware.acehtml.com --> <!-- Creation date: 20-Jan-2006 --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Contribution Help</title> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="piercedjunkmail@hotmail.com"> <meta name="generator" content="AceHTML 5 Freeware"> <link href="ChurchHelp.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="Bar1"></div> <div id="TitleBar">Help for You</div> <div id="MenuBar"> <div id="MenuItem"><a href="index.html">Home</a></div> <div id="MenuItem"><a href="General.html">General Help</a></div> <div id="MenuItem"><a href="Settings.html">Settings Help</a></div> <div id="MenuItem"><a href="Contribution.html">Contribution Help</a></div> <div id="MenuItem"><a href="Member.html">Member Help</a></div> <div id="MenuItem"><a href="SiteMap.html">Site Map</a></div> </div> <div id="imgCont"> <img src="Images/ContributionForm.jpg" border="0" width="427" height="287" alt=""> </div> </body> </html> CSS: Code: body { margin: auto; background-color: #bcb277; font-family: Veranda, Arial, sans-serif; } #Bar1 { background-color: #CC9900; height: 10px; } #TitleBar { background-color: #330033; height: 30px; color: green; font-weight: 25px; padding-top: 5px; padding-left: 10px; } #MenuBar { display: compact; /*float: left;*/ /*width: 100%;*/ background-color: #006600; padding: 2px; } #MenuItem { float: left; margin-left: 30px; color: white; } #imgCont { float: left; padding: 12px; background-color: #a99a66; } a:link { color: white; text-decoration: none; } a:visited { color: #DCDCDC; text-decoration: none; } a:hover { color: #A9A9A9; text-decoration: overline underline; } a:active { color: #8B0000; } I seem to have an issue with the float parameter in Firefox. If you look at the following URL in IE, it should display fine, but in firefox the container doesn't expand to hold the div's within, as they're floated. I've seen other people use floats just fine in firefox, but it doesnt' seem to work for me.. http://www.arestaenterprise.com/enf/ Any help is appreciated Thanks! |