CSS - Css Theory: Float/margin W/ Css Image Rollovers
I was working on a site today and I noticed a weird bug in IE 7. Couldn't find anything similar on the net, so I'll post here.
PseudoCSS: Code: #topdiv{ width:960px; } #bottomdiv{ float: left; margin-left:15px; width: 300px; } .previous a{ background: url('images/previous.png') no-repeat; } .previous a:hover { background-position:0 -62px; } PseudoHTML: Code: <div id="topdiv"><a href="" class="previous">Link</a></div> <div id="bottomdiv">Content</div> When rolling over the image in topdiv, bottomdiv loses it's 15px margin-left and butts up against the left border of the parent div (Only in IE7). I removed the margin-left of bottomdiv and replaced it with relative positioning, left:15px. This fixed the issue and works cross browser. I guess my question is: is relative positioning "safer" than margins on floated elements? Similar TutorialsBackground info: - I have validated the page and CSS, no problems there - Site is working properly in Firefox and IE, seems to be a margin issue in Safari -This margin issue is not the common Safari bug with a negative margin being applied to a floated element -I am using Safari in a windows environment, I do not have a Mac The problem: -in Safari the top margin on the content either is either not being applied at all or is being interpreted differently -it may be of note that I was having the same issue with IE, but was able to specify an IE specific style sheet for it, I don't believe this is possible in Safari? The website: http://www.lisa-noble.com/test/redo.html The HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Site Test</title> <link rel="stylesheet" type="text/css" href="redo.css" /> <!--[if IE]> <link rel="stylesheet" type="text/css" href="iespecific.css" /> <![endif]--> </head> <body> <div id="top_filler"> </div> <div id="left_filler"> </div> <div id="right_filler"> </div> <div id="top_left"> </div> <div id="header"> </div> <div id="top_right"> </div> <div id="content"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <p>Etc, etc, etc....</p> </div> <div id="bottom_filler"> </div> <div id="bottom_left"> </div> <div id="bottom_right"> </div> </body> </html> The CSS Code: * { margin: 0; padding: 0; } body { background: #fdd9e9; } div#top_filler { background: url(images/bg_slice_sm.png) repeat-x; width: 100%; height: 164px; position: fixed; top: 0px; z-index: 5; } div#left_filler { background: url(images/left_slice_sm.png) repeat-y; width: 174px; height: 100%; position:fixed; left:0px; z-index: 5; } div#right_filler { background: url(images/right_slice_sm.png) repeat-y; width: 161px; height: 100%; position:fixed; right: 0px; z-index:5; } div#bottom_filler { background: url(images/bottom_slice_sm.png) repeat-x; width: 100%; height: 76px; position: fixed; bottom: 0px; z-index: 5; } div#header { position: fixed; top: 0px; left: 37%; height: 125px; width: 316px; margin: 0 auto; background: url(pink_logo2.png) no-repeat; z-index: 25; } ul.NoBulletNoIndent { list-style-type: none; margin-left: 0px; padding-left: 0px } div#top_left { height: 314px; width: 221px; background: url(images/left_top_corner_sm.png) no-repeat; position: fixed; top: 0px; left: 0px; z-index: 5; } div#bottom_left { height: 175px; width: 176px; background: url(images/left_bottom_corner_sm.png) bottom no-repeat; position: fixed; bottom: 0px; left: 0px; z-index: 5; } div#top_right{ height:174px; width:174px; background: url(images/right_top_corner_sm.png) top no-repeat; position: fixed; top:0px; right: 0px; z-index:5 } div#bottom_right{ height: 602px; width:198px; background: url(images/right_bottom_corner2_sm.png) bottom no-repeat; position: fixed; bottom: 0px; right: 0px; z-index: 5 } div#content { margin: 40px 164px 0px 180px; position: relative; z-index: 1; } so, i have a form with rounded corners, which i've had no problems with in the past. the problem here is that the background color behind the box with the rounded corners is going to be user-generated and the box itself can change in width. my solution was to float the corners left and right and have the rest filled in the middle. works perfectly in firefox, giving the middle element an automatic width with margins on either side equal to the size of the corner images. however, IE decided to add in extra space between the 3 elements. ive tried giving the elements a display:inline-block property, but it didnt help. Code: #petition_letter { width: 330px; margin: 25px auto 0; } .lettertop .left, .lettertop .right { display: block; width: 15px; height: 15px; background-image: url(lettertop.gif); background-repeat: no-repeat; } .letterbottom .left, .letterbottom .right { display: block; width: 15px; height: 40px; background-image: url(letterbottom.gif); background-repeat: no-repeat; } .letterbottom .right { width: 40px; } .lettertop .left { float: left; background-position: top left; } .lettertop .right { float: right; background-position: top right; } .letterbottom .left { float: left; background-position: bottom left; } .letterbottom .right { float: right; background-position: bottom right; } .lettertop .middle, .letterbottom .middle { display: block; height: 15px; margin: 0 15px; background: #fff; } .letterbottom .middle { padding-bottom: 25px; padding-left: 15px; margin-right: 40px; } .lettercontent { border-bottom: 1px solid #fff; background-color: #fff; padding: 0px 30px; font-size: 12px; } <div id="petition_letter"> <div class="lettertop"> <span class="left"></span> <span class="right"></span> <span class="middle"></span> </div> <div class="lettercontent textColor"> blah blah </div> <div class="letterbottom"> <span class="left"></span> <span class="right"></span> <span class="middle"></span> </div> </div> Just when I think I'm starting to get a handle on things, I run into yet another mystery... Take something like this: Code: <div style="background: orange; float: left;"> This is floated. </div> <div style="background: blue; margin-top: 600px; "> This is not floated. </div> In IE6 (don't have 7 on this machine) and Opera, I get what I expect -- an orange element and 600 pixels below that, a blue element. In Firefox both the orange and blue elements are moved 600 down. Thinking it has something to with clearing, I add: Code: <div style="background: orange; float: left;"> This is floated. </div> <div style="background: blue; clear: left; margin-top: 600px; "> This is not floated. </div> IE6, same result. Firefox and Opera, both elements are now at the top of the page. (clear: both same result) So now I try just adding some other content to the page: Code: <p>This is some text.</p> <div style="background: orange; float: left;"> This is floated. </div> <div style="background: blue; clear: left; margin-top: 600px; "> This is not floated. </div> This mysteriously fixes the issue in Firefox, so now IE and Firefox display the same. Opera still groups the two colored elements together. I'm sure there's something simple I'm not understanding here...any ideas? I have a page that has a header, footer, left content box, and right sidebar. I'm using a negative margin on the content container to get the right sidebar to fill the space so I can keep a sensible order within the html code. The right sidebar isn't taking up the negative margin space like it should. It floats right but takes up residence under the content box. It works without negative margins if I put the right sidebar first in the order (before the content) but I shouldn't have to do that. It also works using absolute positioning on the right sidebar but this is going to be a problem for pages that will have content that takes up less space than the sidebar (because of the footer). I have uploaded the page on one of my servers:test page page so you can see it in action. Here's the CSS/HTML code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style media="screen"> body { margin: 0; padding: 0; text-align: center; } div#pageframe { border: solid 1px black; margin: 0px auto 0px auto; width: 741px; /* total pagewidth */ } div#headerbox { border: solid 1px gray; width: 741px; height: 95px; } div#whiteboxes { border: solid 1px red; width: 741px; float: left; margin-right: -210px; } #middlecontent { border: solid 1px purple; margin-right: 210px; text-align: left; } div#rightside { border: solid 1px yellow; width: 185px; float: right; } div#footer { border: solid 1px olive; float: none; width:741px; height:55px; clear: both; } </style></head> <body> <div id="pageframe"> <div id="headerbox"> <h1>This is the Header.</h1> </div> <div id="whiteboxes"> <div id="middlecontent"> <h1>middle content</h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus varius eleifend tellus. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nulla facilisi. Sed wisi lectus, placerat nec, mollis quis, posuere eget, arcu. Donec euismod. Praesent mauris mi, adipiscing non, mollis eget, adipiscing ac, erat. Integer nonummy mauris sit amet metus. In adipiscing, ligula ultrices dictum vehicula, eros turpis lacinia libero, sed aliquet urna diam sed tellus. Etiam semper sapien eget metus.</p> <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus imperdiet mattis risus. In hac habitasse platea dictumst. Curabitur aliquam rhoncus nunc. Suspendisse sit amet purus in wisi egestas placerat. Nunc varius suscipit magna. Fusce commodo dolor vel felis. Nunc auctor elit vitae justo. Donec lorem. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus diam wisi, tincidunt et, sollicitudin a, ultricies quis, est. Sed ut velit.</p> <p>Aliquam sit amet mi. Pellentesque imperdiet metus vitae wisi hendrerit imperdiet. Donec molestie tortor quis odio rutrum mattis. Donec nec sem. Proin tempus tempor risus. Suspendisse odio. Donec id mi. Maecenas est orci, porttitor eget, vehicula at, rhoncus a, magna. Duis eu tellus. Donec blandit, orci quis commodo tincidunt, mi leo tempor enim, in hendrerit eros lacus blandit urna. Donec sed mi nec dui varius fringilla.</p> <p>Quisque pretium, augue non blandit ultrices, ipsum augue varius velit, a adipiscing nulla nunc consectetuer diam. Maecenas eu ante non dui euismod euismod. Proin est tortor, bibendum in, imperdiet quis, porta vel, purus. Quisque tincidunt tincidunt elit. Suspendisse a mi. Nam faucibus. Aliquam imperdiet pulvinar turpis. Vivamus sit amet elit a leo tincidunt varius. Cras et orci. Aenean non velit vitae risus posuere iaculis. Quisque porta nibh sed massa. Aliquam non ante. Proin semper ipsum nec enim. Maecenas vestibulum nisl non magna. Aenean auctor. Nulla tincidunt augue ac quam. Etiam ultricies purus et metus. Aliquam tempus dignissim felis.</p> <p>Curabitur euismod odio. Suspendisse potenti. Aliquam est augue, feugiat non, sodales nec, aliquet et, massa. Nulla eu tellus sed mi mollis aliquam. Fusce sed sem. Etiam tempus augue non nulla. Nunc pede ligula, fringilla in, lobortis et, dictum a, est. Sed accumsan, nisl vel suscipit scelerisque, arcu turpis dictum augue, ut sagittis metus pede non felis. Donec mollis ipsum eu sapien. Sed eget nisl. Nunc sem eros, dapibus consectetuer, molestie non, elementum sit amet, felis. Donec eu diam eu nibh tincidunt malesuada. Mauris fringilla volutpat odio.</p> </div><!-- end middlecontent --> <div id="rightside"> <h1>right frame</h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus varius eleifend tellus. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nulla facilisi. Sed wisi lectus, placerat nec, mollis quis, posuere eget, arcu. Donec euismod. Praesent mauris mi, adipiscing non, mollis eget, adipiscing ac, erat. Integer nonummy mauris sit amet metus. In adipiscing, ligula ultrices dictum vehicula, eros turpis lacinia libero, sed aliquet urna diam sed tellus. Etiam semper sapien eget metus.</p> </div> </div><!-- end whiteboxes --> <div id="footer"> <p>FOOTER<br />Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus varius eleifend tellus. Suspendisse potenti.</p> </div> </div><!-- end pageFrame --> </body></html> Any help is greatly appreciated. Hi, I have the following CSS code:
Code: a.HomeBN{ background: url('../images/common/nav/btn_home.gif'); width:62px; height:42px; } a.HomeBN:hover{ background: url('../images/common/nav/btn_home_hover.gif'); width:62px; height:42px; } then on my page, I have the following: Code: <a class="HomeBn" href="index.php"></a> The problem is that the home button does not appear at all. what am I doing wrong? thanks Hi all, I've got a simple menu where the buttons are all in HTML text, but I want to put a rollover image behind them - is this possible? Cheers. Hi, Now that the Information bar in IE blocks script from running, my usual Fireworks rollovers always produce the error. I have heard CSS is a good alternative. The code below shows how i have 5 images with links. These are what i would like to be rollovers. Could anyone give me some help on this? Cheers. Code: <tr> <td><img name="index_r2_c1" src="images/index_r2_c1.gif" width="7" height="30" border="0" alt=""></td> <td><a href="index.htm"><img src="images/index_r2_c2.gif" width="82" height="30" border="0" class="rollover"></a></td> <td><img name="index_r2_c3" src="images/index_r2_c3.gif" width="22" height="30" border="0" alt=""></td> <td><a href="about.htm"><img name="index_r2_c4" src="images/index_r2_c4.gif" width="128" height="30" border="0" alt=""></a></td> <td><img name="index_r2_c5" src="images/index_r2_c5.gif" width="24" height="30" border="0" alt=""></td> <td><a href="catalogue.htm"><img name="index_r2_c6" src="images/index_r2_c6.gif" width="150" height="30" border="0" alt=""></a></td> <td><img name="index_r2_c7" src="images/index_r2_c7.gif" width="15" height="30" border="0" alt=""></td> <td><a href="order.htm"><img name="index_r2_c8" src="images/index_r2_c8.gif" width="92" height="30" border="0" alt=""></a></td> <td><img name="index_r2_c9" src="images/index_r2_c9.gif" width="15" height="30" border="0" alt=""></td> <td><a href="contact.htm"><img name="index_r2_c10" src="images/index_r2_c10.gif" width="121" height="30" border="0" alt=""></a></td> <td rowspan="2" colspan="2"><img name="index_r2_c11" src="images/index_r2_c11.gif" width="144" height="44" border="0" alt=""></td> </tr> Been toying with this for awhile now and looking at different tutorials but no such luck. What I have so far: http://www.archanix.com/root/ http://www.archanix.com/root/root.css What I need it to look like: It should turn pink when rolled over. So I have 5 image rollovers onmouseover() all in a row with the following css and javascript. Currently, the left-most image rollsover just fine, but when I try to rollover the others, the image that comes to replace the rolledover one gets put in the left-most spot instead of right on top of the image that was rolledover. I can't use absolute positioning because the whole webpage is centered according to window size. Help is greatly appreciated. Here's the link: create.byu.edu/newsite CSS: Code: div.info { float:left; display:inline; margin-left:0px; margin-top:35px; } div.team { float:left; display:inline; margin-left:0px; margin-top:35px; } div.work { float:left; display:inline; margin-left:0px; margin-top:35px; } div.sites { float:left; display:inline; margin-left:0px; margin-top:35px; } div.news { float:left; display:inline; margin-left:0px; margin-top:35px; } javascript: Code: var image1 = new Image(); image1.src = "images/info.jpg"; var image2 = new Image(); image2.src = "images/infoblue.jpg"; var image3 = new Image(); image3.src = "images/team.jpg"; var image4 = new Image(); image4.src = "images/teamblue.jpg"; var image5 = new Image(); image5.src = "images/work.jpg"; var image6 = new Image(); image6.src = "images/workblue.jpg"; var image7 = new Image(); image7.src = "images/sites.jpg"; var image8 = new Image(); image8.src = "images/sitesblue.jpg"; var image9 = new Image(); image9.src = "images/news.jpg"; var image0 = new Image(); image0.src = "images/newsblue.jpg"; function roll(img_name, img_src) { document[img_name].src = img_src; } HTML: Code: <div class="info"> <a href="info.php" onmouseover="roll('info', 'images/infoblue.jpg')" onmouseout="roll('info', 'images/info.jpg')"> <img src="images/info.jpg" border="0" alt="infogray" name="info"> </a> </div><!--info--> <div class="team"> <a href="team.php" onmouseover="roll('info', 'images/teamblue.jpg')" onmouseout="roll('info', 'images/team.jpg')"> <img src="images/team.jpg" border="0" alt="teamgray" name="team"> </a> </div><!--team--> <div class="work"> <a href="work.php" onmouseover="roll('info', 'images/workblue.jpg')" onmouseout="roll('info', 'images/work.jpg')"> <img src="images/work.jpg" border="0" alt="workgray" name="work"> </a> </div><!--work--> <div class="sites"> <a href="sites.php" onmouseover="roll('info', 'images/sitesblue.jpg')" onmouseout="roll('info', 'images/sites.jpg')"> <img src="images/sites.jpg" border="0" alt="sitesgray" name="sites"> </a> </div><!--sites--> <div class="news"> <a href="news.php" onmouseover="roll('info', 'images/newsblue.jpg')" onmouseout="roll('info', 'images/news.jpg')"> <img src="images/news.jpg" border="0" alt="newsgray" name="news"> </a> </div><!--news--> Using either CSS, or JavaScript, or a combination of both; is it possible to do this without using frames?: image1 and image2 are laid out horizontally across the top of the page. When the mouse hovers over image1, a formatted body of text (lets call it "text1") is displayed beneath the layout of images. As the mouse leaves image1, the text disappears. When the mouse hovers overs over image2, a different body of text ("text2") appears in the same area where text1 was displayed. It also disappears as the mouse leaves. I am probably very obviously a newbie. I have read examples that show how to do similar things with frames, and I can script simple image rollovers, but I am a little lost here, so even if this is too basic a question, if you can point me in the right direction to learn how, I would appreciate it much. Thanks in advance for any help or suggestions! Hi There, I am working on a new layout for a control panel. I have the basic layout coded up: http://www.lampdesign.co.uk/desdev/ss/ I am now needing to put a row of icon images in for the various sections of the control panel - here is an example of what they look like: http://lampdesign.co.uk/desdev/ss/images/buttonbar.png Is it possible to do a rollover image list?, I have looked on listomatic and there are image lists with rollover bg images but no actual image rollovers. I am not 100% sure what to do - I could do tables but I'd rather not! Any ideas? Thanks Hi, I am trying to create a menu, and I would like to try to do it without using Javascript. I a number of menu items, that each has three states - first state is just white text, second state needs to fade from white to blue text when mouse is rolled over. Third state needs to fade from blue to white text when mouse is taken off each menu item. I have the three images for that (white, white-blue, blue-white). I have read up on a few image rollover guides using CSS, but they all involve putting outlines around an existing image etc. As the images need to be links, they can't be background images (can they?), they have to be just images. So, can anyone point me in the right direction on how to swap an image with another when one a) an image is rolled over, and also b) when the mouse is removed from over the image. Thanks Of course I've seen lots of CSS navigation using image rollovers, and others using dropdowns, but I haven't been able to find any that use both at the same time. I'm trying to put it on a WordPress site ... Any links or help would be much appreciated! Laura S. I've seen the link that Kravitz has linked to http://www.dynamicsitesolutions.com...mage_switching/ and while helpful, I think I'm becoming more confused. Part of the problem is that in those examples (and even there I'm getting confused over which example is supposed to be the one to use) the images are assumed to be the same width, so the property is set for 120px. But my images are different widths. Now I can make the rollovers work by for example: Code: .item1 a { background-image : url(menuoffa.jpg); float:left; height:28px; width:103px; } .item1 a:hover { background-image : url(menuona.jpg); float:left; height:28px; width:103px; } and then using html in the following way: Code: <div class="item1"><a href="pagelink.htm"></a></div> My problem is that I can't center the items relative to the page If I were going to use 'tables' to do this, then I'd put all the items in one centered cell, but the whole point is not to use tables so what am I doing wrong?!?! Probably more like, what am I doing right, but anyway... And I've tried reading up on going the horizontal unordered list way http://www.webreference.com/program...ists/index.html but I'm using images instead of text so same problems still OMG I'm going insane Originally, I used <DIV> as containers for background images which swap when you hover over them. I enclosed the <DIV> tags with <A> tags to make them 'links'. Older versions of IE didn't want to work with this though and I found it this is invalid CSS, so I explored some more... The best solution I have found so far is to use <A> itself as a container. This solved the IE5 problems, but now IE4 SP2 doesn't show them at all. I'm okay with leaving IE4 behind, but I discovered that using <A> tags as containers was an invalid technique. If I can't use <A><DIV> and I can't use <A>, then what can I use to make valid, preloaded CSS image rollovers that work? I'm not considering Javascript an option. Is it possible? Here's a random, simliar example of what I've done with the <A> tags. http:// www. findmotive. com /2006/10/31/simple-css-image-rollover/ I always seem to run into this problem and somehow get it fixed but this time I am stuck. I have a main wrapper and 2 footers that line up together and are all floated to the left. I'm trying to put in a column to their right that runs vertical called "right", to be spaced out about 110 px from the top of the page so it sits vertically below the banner and the navs. I tried giving it a left margin to clear the floated DIV's but to no avail. You can see the page he http://yourthreshold.com/playground/ It seems to clear in Firefox but not in IE .. The main CSS: Code: * { margin: 0; padding: 0; } body { margin:0; padding:0; background-color:#e5e5e5; } #wrapper { width: 640px; height: 720px; margin-left:0; margin-top:0; border: 2px solid gray; border-bottom: 0px solid gray; background-image:url(../images/banner.jpg); background-repeat:no-repeat; background-color:#c0c0c0; float:left; } #navigation { width: 640px; height: 22px; background-color:#c9c9c9; margin-top: 88px; } #insidewrapper { height:auto; width:99%; margin: 6px 1px 4px 1px; } /* Begin Left Side Info Boxes */ #sidebar { width:150px; height:600px; margin-left:2px; float:left; border:1px solid #666666; border-bottom:0px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#666666; background-color:#ffffff; } .infobox { height:123px; font:Verdana, Arial, Helvetica, sans-serif; font-size:9px; padding:3px; border-top:0px; border-left:0px; border-right:0px; } .infopic { margin-top:9px; } .infobutton { height:20px; border-bottom:1px solid #666666; padding-left:3px; } /* Begin Main Content */ #maincontent { width:465px; height:593px; margin-left:158px; border:1px solid; border-color:#666666; font:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#333333; padding:3px; background-image:url(../images/background_trans2.gif); background-repeat:no-repeat; background-position:center; background-color:#ffffff; } /* Main Content for pages with textual content */ #content { width:97%; height:auto; padding:5px; } /* Main Content for pages with products */ #productWrapper { height:auto; width:100%; margin-top:10px; } #productLeft { height:auto; width:115px; float:left; } #productMiddle { height:auto; width:200px; margin-left:1px; float:left; } #productRight { height:auto; width:auto; } /* Begin Footer */ #footerlinks, #footer { width:640px; height:auto; text-align:center; float:left; } #footerlinks { border-right: 2px solid gray; border-bottom: 1px solid gray; border-left: 2px solid gray; background-color:#c0c0c0; font:Verdana, Arial, Helvetica, sans-serif; font-size:9px; letter-spacing:1px; color:#555555; padding-bottom:4px; } #footer { margin-left:0; margin-top:0; margin-bottom:15px; padding-top:8px; border-top: 0px; border-right: 2px solid gray; border-bottom: 2px solid gray; border-left: 2px solid gray; font:Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#555555; background-color:#a9a9a9; } /* Begin Rightside Column */ #right { border: 1px solid orange; width:195px; margin-left:650px; padding-top:111px; } I've noticed that now that I separate markup and presentation that my CSS files are significantly larger. For instance just one of my pages worth of presentation declarations is 300 lines long. Given an extremely large site, do you think you'd ever have to get to the point where you'd preload the CSS file? -B Can anyone please tell me why this code isnt working? Code: <html> <head> <style type="text/css"> p.leftfloat {img-float: left} </style> </head> <body> <p>In the paragraph below, we have added an image with style <b>float:right</b>. The result is that the image will float to the right in the paragraph.</p> <p class="leftfloat" > <img src="logocss.gif" width="95" height="84" /> </p> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </body> </html> Hello, first post here... I have an image floated left, with an unordered list (ul) next to it. Problem is, the margin values I set for the list are totally ignored, so the list bullets end up overlapping the image. Seems the only solution is to set margins on the image, but that also pushes away non-overlapping content, like the h3 that is above the list and positioned fine. Any ideas? Everything works fine if/when I float the list left, but that seems draconian... Code: css Code: Original - css Code img.alignleft { margin-right:0.5em; display:inline; float:left; } ul, ol, dl { line-height:1.5em; margin:0 0 1em 1em; }
HTML4Strict Code: Original - HTML4Strict Code <p><img src="" width="295" height="400" class="alignleft"/></p> <h3>A Sampling of Workshops We Have Brought to Nonprofits</h3> <ul> <li>An Introduction to Social Media for the Nonprofit</li> <li>An Introduction to Storytelling for the Nonprofit</li> <li>Using Social Media and Digital Storytelling in the Classroom</li> </ul> <p><img src="" width="295" height="400" class="alignleft"/></p> On page - URL address blocked I have an img floated to the left, with some text floating around the right side. After this image, I have an h2, styled to clear:both, with a top-margin: 3em. With this floated image preceding, when the image is longer than the paragraph or other text floating around it, and the bottom of the image is "sitting on top of" the h2, the browser ignores the 3em top margin on the h2, unless I include a br, styled to clear:both. So, I can solve the problem with this clearing break, but it sort of chafes me. This doesn't look like typical collapsing margin. I'm not losing the overlapping margin between the two elements, I'm losing all of the margin! The page is coded with the breaks in place. I can re-create the "issue" using Firebug to remove the br tag. Suggestions? Thanks in advance. |