CSS - Float:right, Text Spills Out Of Container Element
okay I don't know why my text will not wrap in any of my "float:rights" My quicklink section I don't care about as much as the feature student section I'm building. The text spills out of the paragrah block and keeps running.
http://www.mgan.net/form-honors/main(2).htm Any thoughts on how to fix it or a link to a site that would explain it's just as good Similar TutorialsIv got my boxes sorted!!! but im quite newbie to CSS layout and stuff... so i want to put two boxes in side my container box side by side. i decided to use float... but they float outside my container box, which i suppose is what they are supposed to do. This is what im trying to achieve. Code: ---------------------------------------------------- | --------------------- --------------------- | | | | | | | | | | | | | | | Float Left | | Float right | | | | | | | | | | | | | | | --------------------- --------------------- | ---------------------------------------------------- Hi, I have a container with a border that works fine , but when I float 4 elements that are in a row, the container shrinks, and they are outside the container. How can I align four boxes, and keep them in the container? here's the example: http://www.caillouette.com/alpha-dream/ thanks I am having some trouble using float to align containers on my page. Here is what it looks like. http://filebox.vt.edu/users/kfalcon...less_broken.JPG In this image the blue area is the "content" id, the red area is the "rostercontainer" and the cream color is the "profilecontainer". I would like the profilecontainers to appear in two columns instead of one as in this image. The problem is when i add 'float : left' to the profilecontainer or rostercontainer I get the following: http://filebox.vt.edu/users/kfalcon...scrn_broken.JPG The two profile containers are now next to each other, but the rostercontainer seems to be missing, and the profilecontainers are not being loaded into the content area. From the index.php page i am using javascript to load the roster.php page into the content area. Code: <div id="main-nav"> <dl> <dt id="roster"><a class="loadinto-content" href="roster.php">Roster</a></dt> </dl> </div> <div id="content"> <h2>Main Page</h2> </div> The roster.php page looks like this: PHP Code: <div class="rostercontainer"> <?php // Go through all profiles while($profile = mysql_fetch_assoc($profiles)) { ?> <div class="profilecontainer"> <img src="image3.gif" class="floatLeft" width="150" height="115" alt="image 3" /> <strong><h3 class="profile"><?php echo $profile['name']; ?></h3></strong><br/> <?php echo $profile['active']; ?><br/> <?php echo $profile['status']; ?><br/> <?php echo $profile['ride']; ?><br/> <?php echo $profile['major']; ?><br/> <?php echo $profile['hometown']; ?><br/> <?php echo $profile['info']; ?><br/> <div class="editlink"> <a href="roster_admin.php?idx=<?php echo $profile['id']; ?>">edit</a> </div> </div> <?php } ?> </div> And here is my css file, ive only included the important parts. Code: #page-container { width: 760px; margin: auto; } #content { font-family: Tahoma, Arial, Helvetica, Sans-serif; background: blue; border-top: 1px solid #efefef; padding: 25px; } div.profilecontainer { position: relative; width: 325px; height:200px; margin: 10px; padding: 5px; background-color: #ffe; border: 1px dashed black; } div#content div.rostercontainer { background-color:red; float : left; } I am not sure if this is a CSS issue or some problem with the javascript library(HTMLHttpRequest) i am using to load pages into my content area. It is really odd the adding the float to the roster/profile container would cause such a behavior. Any ideas on how i can fix this? Thanks for any help, Karl Hoping someone can help. I'm trying to figure out a way to align something to the left of an existing element within a container of variable height. The existing element is already aligned to the left edge of the container. To be more specific, I am trying to place a helper graphic to the left of the email text-field in the "Leave a Comment" form (not the "Email this Zing" form) on this page: http://www.zingfu.com/?zing=4419693e9e98f If it's possible to the place the helper graphic right next to the text field in the code, but then to break it out of the container div to move to the left of the text field, that would be great. Or if I could apply positioning to the helper graphic based on the positioning of the text field, that'd be fine too. But I'm not sure if either is possible. Little help? I have a container div that has a height of 500px. My page content only takes up about 300px and I want a copyright notice at the bottom of the page. So I am trying to get the copyright div to bottom align on the container div. In FF, position:absolute;bottom:0; works but that doesn't work in IE which for some reason places the div outside the container div. Any tips on how to do this? I'm looking for a CSS element that behaves like a table, where the size of the container will always be just big enough to surround the data inside, and will grow or shrink based on the content inside without having to specify any widths or heights. A div (with a border) with no width specified will go on forever horizontally. A table (with a border) with no width will stop as soon as the data inside ends. Is there a way to simulate this table behavior using CSS? Thanks Hi all 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> new document </title> <style> div.outer { background-color: yellow; overflow: auto; } h1 { margin: 10px; } </style> </head> <body> <div class="outer"> <h1>Title</h1> </div> </body> </html> Expected result (Firefox): expected.JPG Unexpected result (Internet Explorer): unexpected.JPG Is there something I can do against this instead of adding a padding-top to the H1 or a padding-top to the div.outer? Thanks for help, Josh Hi all, The easiest way to see the problem is to look at this demo in firefox. (I haven't patched it to work in IE yet.) The menu items in the 1st 2 menu's don't expand to fill the available area. Any ideas? Hi, any help with this would be very useful? I'm having trouble with a float element on ie. It works fine on firefox, basically I'm wanting an element to be removed from the flow of all the other elements and placed on top... Heres the simple code, the colors are just to show the elements positioning. HTML <body> <div id="wrapper"> <div id="picture"></div> <div id="header">content</div> <div id="content"> content content content content content content content content content content content content.....</div> <div id="footer"></div> </div> </body> CSS body { text-align: center; } #wrapper { width: 750px; text-align: left; } #header { width: 100%; height: 50px; margin-top: 10px; background-color: #009966; } #content { width: 100%; height: auto; background-color: #CCCCCC; min-height: 300px; /*ie ignores this one*/ height: 300px; /*ie treats this as min height*/ } *>#content { height: auto; /* ie ignores child selector, modern browsers replace height declaration */ } #footer { width: 100%; height: 25px; background-color:#FF0000; } #picture { height: 350px; margin: 15px; width: 200px; float: left; background-color:#FFFF99; } Firefox displays fine with the green header, grey content, and red footer with the yellow picture element overlapping. IE puts the three content elements below the picture element.. I tried making the #picture position: absolute and this almost works except the content goes behind the picture! And I tried removing the width 100% from #header, #content, #footer and this almost works - its positioned right but the background does not flow under the #picture?! any thoughts? thanks. John Hey guys, I'm now truly understanding why all my tech friends constantly talk about how much they hate IE. Anyways, im working on a site and am trying to add a corner element to one of my divs. It works perfect in firefox... but in IE it pushes the table below it and adds like a 2px wide sliver to the right of the img. Here is the table layout Code: <div class='wrapp'> <img src='Images/tr.gif' /> <table style='width:100%;'> <tbody> <tr class='time'> <td colspan='6' style='text-align:left;'>" . date('F d Y',$key[5]) . ", " . date('g A T',$key[5]) . "</td> </tr> </tbody> </table> [/div] Then here is the related CSS codes to make the image float to the right. Code: .wrapp { margin-bottom:8px; width:354px; text-align:center; } .wrapp img { float:right; display:inline; } table { margin-left:auto; margin-right:auto; } So once again what im trying to do is have the corner img show on the top right corner of the wrapp div. It works perfect in firefox but again it does not work in IE... and I have read about 20 articles on google that talk about these problems but I just can't figure the right combination out to make it work. Thanks in advance for any help! Hello, I have a problem appearing only in IE8, but I don't seem to find the exact bug and solution. In this page http://www.cracowflats.com/index.php/search/show/id/181 there is a Details area (bottom left) where titles have a green background. For some reason this green background appears in other parts of the page. In other browsers, the whole page has a white background, as it should. 1) With this code in theme.css a {color:#62860b; } h3, h4 { color: #70af1d;} .color_title { background: #76a637;color:#fff;} .logo h1 a { color: #62860b !important;} it appers everywhere and the whole background of the page is green (should be white). 2) when I add an "overflow: hidden;" here .color_title { background: #76a637;color:#fff; overflow: hidden;} it gets better, as the main area is white. But I still have a lot of green on the footer (and tabs). If I could find out to which bug it refers, it would be easier to find a solution. Any hint would be appreciated! Thanks! Luca Good Day, I agreed to do a website for a friend and they have purchased a template that I have been working with. I am very new to CSS so I don't even understand some o the terminology. The best way to describe my problem is to show you what is happening to the text when it is added. This is what the page looks like with limited text: http://lisawesselsphotography.ca/services.html It looks ok from here This is what it looks like when a greater amount of text is inserted: http://lisawesselsphotography.ca/services-test.html Not so cool looking Here is my css: Code: html, body { height: 100%; } body { margin: 0px; padding: 0px; background: #11121A url(images/bg1_01.jpg) repeat; font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #5A5D6A; } h1, h2, h3 { margin: 0px; padding: 0px; } p, ol, ul { margin-top: 0px; } ol, ul { margin: 0px; padding: 0px; } p { line-height: 220%; } strong { font-weight: normal; color: #FFFFFF; } a { color: #A40000; outline: none; } a:hover { text-decoration: none; } a img { border: none; } img.border { } img.alignleft { float: left; padding-right: 25px; } img.alignright { float: right; } img.aligncenter { margin: 0px auto; } hr { display: none; } ul.style1 { margin: 0px; padding: 0px 0px 0px 15px; } ul.style1 li { padding: 3px 0px; } ul.style1 span { color: #FFFFFF; } /** WRAPPER */ #wrapper-content { background: url(images/bg1_02.jpg) repeat-x left top; } #wrapper { background: url(images/bg1_05.jpg) repeat-y center top; } #wrapper-bgtop { background: url(images/bg1_03.jpg) no-repeat center top; } #wrapper-bgbtm { overflow: hidden; padding-top: 132px; background: url(images/bg1_04.jpg) repeat-y center bottom; } .homepage #wrapper { background: url(images/bg3_03.jpg) repeat-y center top; } .homepage #wrapper-bgtop { background: url(images/bg3_01.jpg) no-repeat center top; } .homepage #wrapper-bgbtm { background: url(images/bg3_02.jpg) no-repeat center bottom; } .single #wrapper { background: url(images/bg3_03.jpg) repeat-y center top; } .single #wrapper-bgtop { background: url(images/bg2_01.jpg) no-repeat center top; } .single #wrapper-bgbtm { overflow: hidden; padding-top: 132px; background: url(images/bg2_02.jpg) no-repeat center bottom; } .gallery #wrapper { background: url(images/bg4_03.jpg) repeat-y center top; } .gallery #wrapper-bgtop { background: url(images/bg4_01.jpg) no-repeat center top; } .gallery #wrapper-bgbtm { overflow: hidden; padding-top: 132px; padding-bottom: 60px; background: url(images/bg4_02.jpg) no-repeat center bottom; } .container { width: 900px; margin: 0px auto; } .clearfix { clear: both; } /** HEADER */ #header { } /** LOGO */ #logo { width: 300px; height: 174px; } .homepage #logo { width: 300px; height: 350px; } #logo h1, #logo p { margin: 0px; line-height: normal; text-indent: -9999em; } #logo h1 a { display: block; top: 0px; left: 0px; width: 950px; height: 174px; background: url(images/homepage02.png) no-repeat left top; } .homepage #logo h1 a { display: block; top: 0px; left: 0px; width: 950px; height: 350px; background: url(images/lisalogo1.png) no-repeat left top; .logotext {float:right;} } /** MENU */ #menu { height: 45px; padding: 15px 0px 0px 40px; } #menu ul { margin: 0px; padding: 0px; list-style: none; line-height: normal; } #menu li { float: left; padding: 0px 30px; } #menu a { float: left; display: block; height: 23px; margin: 0px; padding: 6px 0px 0px 0px; line-height: 1; letter-spacing: -1px; text-decoration: none; text-transform: uppercase; text-shadow: #270000 -1px 2px 3px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; color: #FFFFFF; } #menu a:hover { text-decoration: underline; } #menu .active { background: url(images/subpage1_02.jpg) repeat-x left top; } /** PAGE */ #page { } /** CONTENT */ #content { } .homepage #content { height: 290px; background: url(images/homepage022.jpg) no-repeat center top; } .gallery #content { padding: 0px 45px; } .single #content { padding: 100px; } /** SIDEBAR */ #sidebar { } /** FOOTER */ #footer-wrapper { height: 200px; background: url(images/bg1_06.jpg) no-repeat center top; } #footer { padding-top: 40px; } #footer p { margin: 0px; padding: 0px 0px 0px 0px; line-height: 220%; color: #31343F; } #footer .column1 { float: left; width: 575px; } #footer .column2 { float: left; width: 50px; height: 82px; background: url(images/subpage1_03.jpg) no-repeat center top; } #footer .column3 { float: right; width: 275px; text-align: right; } #footer .copyright { padding-top: 5px; font-size: 10px; color: #252732; } #footer .copyright a { color: #252732; } .box-style { } .box-style .title { margin: 0px; padding: 0px; letter-spacing: -1px; text-transform: uppercase; font-size: 28px; font-weight: bold; color: #FFFFFF; } .box-style .byline { margin: -10px 0px 30px 0px; padding: 0px; letter-spacing: -1px; text-transform: uppercase; font-size: 14px; font-weight: bold; color: #363945; } /* GALLERY */ #slideshow { } #gallery { position: relative; width: 804px; height: 337px; margin: 38px 0px 50px 0px; } #gallery .slide { width: 634px; height: 337px; position: absolute; left: 85px; top: 0px; background: url(images/gallery_01.jpg) no-repeat left top; } #gallery .output { position: absolute; top: 17px; left: 17px; } #gallery .border { width: 600px; height: 300px; position: absolute; top: 17px; left: 17px; background: url(images/gallery_borders.png) no-repeat left top; } #gallery .captions { width: 600px; height: 55px; position: absolute; left: 17px; top: 262px; background: url(images/gallery_caption.png) repeat left top; font: 12px Arial, Helvetica, sans-serif; text-transform: uppercase; } #gallery .captions p { margin: 0px; padding: 22px 0px 0px 0px; line-height: 1; text-shadow: #000000 0px 2px 0px; } #gallery .captions .left { float: left; padding-left: 20px; color: #FFFFFF; } #gallery .captions .right { float: right; padding-right: 20px; color: #777777; } #gallery .prev, #gallery .next { display: block; width: 68px; height: 106px; position: absolute; top: 116px; text-indent: -9999em; } #gallery .prev { left: 0px; background: url(images/gallery_02.jpg) no-repeat left top; } #gallery .next { right: 0px; background: url(images/gallery_03.jpg) no-repeat left top; } #gallery-thumbnails { width: 750px; margin-left: 30px; } #gallery-thumbnails ul { margin: 0px; padding: 0px; list-style: none; text-align: center; } #gallery-thumbnails li { float: left; display: block; width: 120px; height: 60px; padding: 15px; position: relative; } #gallery-thumbnails img { } #gallery-thumbnails .border { display: block; width: 130px; height: 70px; position: absolute; left: 10px; top: 10px; background: url(images/gallery_borders.png) no-repeat left bottom; } #gallery-thumbnails .active .border { background-position: -130px 100%; } Hi there, I'm making a weblog layout made in php all the articles are going to be stored on the center of the screen, the code I used for this is width:50%, but how do I make the css code so that the center page color will be all the way at the bottom no matter what size of a window is used? Thanks in advanced! Hello, I Have an div of an sertain width. And there is some text like. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Which is wider then the div itself. Now the tekst overlaps the div borders. How can i fix this without getting a scrollbar. Thx in advance. I have a row of icons (for navigation, with a text description underneath them) I am trying to break out of table design so I want these divs aligned next to each other, with the image/text centered. Everything looks pretty peachy... but in FF the text such as "Candidates" underneath the icon floats to the left because of the parent float.. it ignores the text-align: center. In other browsers it works but not in FF any help? Also if anyone has a better way of writing this code I would be open to suggestions since I am slowly breaking away from table design. Thanks! Code: .main #header { background: #FFFFFF; padding: 0 10px 0 10px; border-bottom: 1px solid black; border-top: 1px solid black; } .icon_nav{ font-size: 12px; float: left; text-align: center; margin-right: 12px; border: 1px solid black; } Code: <div id="header"> <div style="float: left"> <img src="images/logo.png" align="left" style="margin-right: 4px"/> <div style="color: #992204; font-size: 18px">XYZ Company</div> <div style="color: #992204; font-size: 14px">Professional Company</div> <div style="color: #992204; font-size: 12px">481-555-5555</div> </div> <div style="float: right;"> <div class="icon_nav"><img src="images/icons/home.png" /><br />Home</div> <div class="icon_nav"><img src="images/icons/employers.png" /><br />Employers</div> <div class="icon_nav"><img src="images/icons/candidates.png" /><br />Candidates</div> <div class="icon_nav"><img src="images/icons/directions.png" /><br />Directions</div> <div class="icon_nav"><img src="images/icons/event_planning.png" /><br />Event Planning</div> <div class="icon_nav"><img src="images/icons/contactus.png" /><br />Contact Us</div> </div> <br style="clear: both;" /> <!-- end #header --> </div> Firstly, excuse my title, I couldn't think of a better way to put it . Now to the problem. In my layout I have a floated object, and text that flows around it, I can pad the text away from this floated object by using margins on the floated object. But I have created a class for <p> that I want to be padded further, and if I add padding-left to p.quote (the class) it makes no difference because the padding is simply going behind the float... As rubbish as that explanation was, I expect someone will pick up on what I'm going on about. How can I have some text indented (padded) further away from the float than other ? Thanks in advance. Hello, I'm new to css layouts. I had to float:left every element so the heights stretch problem is if the image in "page_c_left" is wider than 45% then "page_c_right" will automatically go on the next line. (in Firefox, IE seems to wrap the text without moving the element). also, i wanted to have the content displayed first for non-css browsers, but the examples used position:absolute. when the impression i got was that float is preferable to position. i'm very confused on which method to use for layouts. what method would you use for complex css layouts? float, position or other? this is code with the text wrap problem Code: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>test</title> <style type="text/css"> #main_c { float:left; width:770px; padding: 10px; border: 1px solid black } #header_c { float:left; border:1px solid brown } #page_c { float:left; width:100%; border:1px solid red } #page_c_left { float:left; padding:10px; border:1px solid blue } #page_c_right { float:left; width:55%; padding:10px; border:1px solid green } #footer_c { float:left; border:1px solid yellow } </style> </head> <body> <div id="main_c"> <div id="header_c"> THIS IS THE HEADER </div> <div id="page_c"> <div id="page_c_left"><img src="../../photos/image.jpg" alt="image" /></div> <div id="page_c_right">RIGHT SIDE paragraph RIGHT SIDE paragraph as ohajst aisdncn uajajs ajshd hfhgg<br />lakshh toyt a bTr asnf f Uahdlalsl jahjsu aujsjdhduwhtn ausud aushd aiua akshdusjj<br /> ka u annf au ffsdjkfjs didjs dd sjskjdk<br /> SIDE paragraph RIGHT SIDE paragraph as ohajst aisdncn uajajs ajshd hfhgg<br />lakshh toyt a bTr asnf f Uahdlalsl jahjsu aujsjdhduwhtn ausud aushd aiua akshdusjj<br /> ka u annf au ffsdjkfjs didjs dd sjskjdk<br />RIGHT SIDE paragraph RIGHT SIDE paragraph as ohajst aisdncn uajajs ajshd hfhgg<br />lakshh toyt a bTr asnf f Uahdlalsl jahjsu aujsjdhduwhtn ausud aushd aiua akshdusjj<br /> ka u annf au ffsdjkfjs didjs dd sjskjdk<br /> SIDE paragraph RIGHT SIDE paragraph as ohajst aisdncn uajajs ajshd hfhgg<br />lakshh toyt a bTr asnf f Uahdlalsl jahjsu aujsjdhduwhtn ausud aushd aiua akshdusjj<br /> ka u annf au ffsdjkfjs didjs dd sjskjdk<br /></div> </div> <div id="footer_c"> THIS IS THE FOOTER </div> </div> </body> </html> if you could help, thank you When i float my div to the left, i cant seem to get the text to align right, can someone show me a way out of this horriable predicament i have found my self in!! this is kind of a crude copy/paste of my current code, but it shows the problem. 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> new document </title> <style> #contentstylesubheader { float: left; padding-left: 16px; height: 53px; padding-right: 30px; padding-top: 15px; } #contentstylesubheaderleft { float: left; font-size: 12pt; font-weight: bold; } #contentstylesubheaderright { text-align: right; position: relative; z-index: 100; float: right; } </style> </head> <body> <div id="contentstylesubheader"> <div id="contentstylesubheaderleft">blahblah</div> <div id="contentstylesubheaderright"> <span id="item_price">blah</span> <a href="#"><img src="../images/buynowbutton.gif" class="imgvalignmiddle padleftmedium padbottomsmall" alt="Add to Cart" /></a><br/> <a href="#"><img src="images/review_sm.png" alt="Review Our Payment Plan" /></a> </div> </div> </body> </html> I posted something the other day, but that thread was elaborate but not helpful at all, because it missed a useful example with CSS sheet and everything. So here's another attempt and hopefully people know where the problem resides. I've stripped down the following page as far as I could within limited time. Before you click and open this URL, I think it's best to read my introduction first, because the problem often only occurs the first time after opening IE5.5 or IE6.0. With IE6.0 it might be that it _does_ work for you now. I notice that the bug is very infrequent with IE6.0. Sometimes it feels like IE6.0 cached the right page and doesn't want to show the wrong page the first time anymore. With IE5.5 it's still consistent on first time though... it will show the bug! A refresh may fix the page. Which is basically like opening the page a second time. http://www.stack.nl/~rem/problem.html It's a page with 3 big sections: header, middle, footer. I've stripped the footer as far as possible and reduced the header. The footer stays at the bottom of the window/viewport or bottom of the page if the page is longer and requires scrolling. What problem to look for? The news section to the right, it should have 2 identical blocks (in this example). But it cuts off the second block entirely and cuts the end of the first one. Basically where the form ends on the left side. On reload of the page the error will be "fixed". By accident I stumbled upon this thread (<- link) where they also seem to discuss the cut off of contents when the regular body text is shorter than the float text. Though for me the problem only appears on the page with the form and not with other pages. They couldn't figure out the trigger or cause either and the thread stopped in 2002. I'm trying that <p></p><p></p> workaround... If anybody knows some other workarounds or knows what triggers this problem. Feel free and invited to post any suggestion that can solve this matter. Adding more contents text is no option alas. |