CSS - Text Not Flowing Around Floated Image
The text in the <p> isn't wrapping around the image in IE. Works fine in FF. What am I doing wrong?
Code: <div class="floatright"><a href="./images/storyimages/1192298760_15.jpg"><img class="storyimage" border="0" src="./images/storyimages/thumbs/1192298760_15thumb.jpg" alt=""></a><br>This is a caption</div> <p> Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse viverra, orci venenatis consectetuer faucibus, purus nibh feugiat libero, nec pulvinar nulla orci ut lectus. Ut pellentesque pharetra erat. Proin quis lacus ut sapien ullamcorper consectetuer. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse viverra, orci venenatis consectetuer faucibus, purus nibh feugiat libero, nec pulvinar nulla orci ut lectus. Ut pellentesque pharetra erat. Proin quis lacus ut sapien ullamcorper consectetuer. </p> This is all in the main_col_right <DIV>. Here's the CSS: Code: .floatright { float: right; margin: 0 10px 10px; } #main_inner_wrap { margin:0 auto; width:690px; } #main_inner_wrap p { font-family: Geneva, Verdana, Arial, Helvetica, sans-serif; font-size: .9em; line-height: 1.4em; padding:0 10px; min-height: 100%; } #main_col_left { float:left; width:150px; color: #330; line-height: 1.5em; } #main_col_right { margin-top: 0; float:right; width:540px; color: #330; background:url("./images/news_bg.gif"); background-repeat: repeat-y; } Similar TutorialsHi, I'm fairly new to CSS but I've been enjoying working with it. I've now stumbled onto a problem that is making me tear my hair out. I have a centered, fixed width 2-column design. and I'm trying to insert an image and float it left so that the text in the div wraps around it. The problem is that the image keeps being pushed down to the 3rd or 4th paragraph instead of the actual paragraph it's placed in. What could be causing this? I've included my code below. Thanks! Code: /*----------PAGE CENTERED AND FLUSH TOP-----*/ *{margin:0px; padding: 0px; } /*---------------BODY BACKGROUND------------*/ body{ background-color:#333333; } /*-----------BACKGROUND-CONTAINER-----------*/ #background-container{ width: 780px; background-color:white; margin: 0px auto; padding-top:0px; padding-bottom:0px; font-family:Arial; font-size:10pt; } /*-------HEADER ELEMENTS----------*/ #banner{ width: 780px; height: 200px; background-color:#CC9900; background-image:url(); border-bottom: 5px solid #333333; } #header{ width:770px; background-color:#FFFFFF; background-image:url(vertical-scanline.jpg); padding-left:10px; font-family: Arial; font-size:29px; font-weight: bold; } /*-----------BEGIN DROP-DOWN MENU--------*/ div#listmenu{ background-color:#860505; font: 10pt Arial; float:left; width:780px; margin: 0px auto; } div#listmenu ul{ margin: 0 0 0 30px; } *html div#listmenu ul{ float:left; border-left: 1px solid gray; margin-left:15px; } *html a{display:block; color:#FFFFFF;} div#listmenu li{ float:left; position:relative; background-color:#860505; list-style-type:none; padding: 0 6px; border-right:1px solid black; } div#listmenu ul li ul{ margin: 0px; position:absolute; width:10em;} div#listmenu ul li ul li{ width:100%; border-left: 1px solid gray; border-right: 1px solid gray; border-bottom: 1px solid gray; } div#listmenu li{first-child: border-left: 1px solid black; } div#listmenu ul li ul li {first-child: border-top: 1px solid gray; } div#listmenu a{ text-decoration:none; font-weight:bold; color:#ffffff; display:block; padding: 0 6px; background-color:#860505; } div#listmenu a:hover{ background-color:#FFFFFF; color:#000000; } body div#listcontainer ul li ul {display:none;} div#listcontainer ul li:hover ul { display:block; } div#listcontainer ul li:hover ul, div#listcontainer ul li ul:hover {display:block; z-index:25; } /*-----------END DROP-DOWN MENU--------*/ /*-----CLEARING ELEMENT BEGIN---------*/ .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix {display: inline-block;} * html .clearfix {height: 1%;} .clearfix {display: block;} /*-----CLEARING ELEMENT END---------*/ /*--------------MAIN CONTENT---------*/ #main-container{ background-color:#ffffff; } /*----------COLUMNS--------*/ #sectionright{ width:190px; background-color:#860505; border-bottom: 5px solid #333333; font-family:Arial; font-size:14px; font-weight:bold; color:#FFFFFF; text-indent:20px; float:right; } #rightcol{ width:190px; background-color:#CCCCCC; font-family:"Arial"; color:#000000; font-size:12px; text-align: left; text-indent:20px; border-bottom: 5px solid #333333; padding:0px; float: right; clear:right; } #subscription{ width: 190px; background-color:#CC9900; border-bottom: 5px solid #333333; font-family:Arial; text-align:left; font-size:10px; margin-bottom:3px; float: right; clear:right; } #crisp{ width:190px; height:150px; background-color:#FFFFFF; border-bottom: 5px solid #333333; font-family:"Arial"; color:#000000; font-size:11px; text-align:left; float:right; clear:right; margin-bottom:3px; } #logo{ width:190px; height:90px; background-color:#FFFFFF; border-bottom: 5px solid #333333; float: right; clear:right; } #left-floater{ width:150px; padding-top:50px; float:right; background-color:#FFFFFF; font-size:11pt; } #floater-bottomleft{ width:150px; padding-top:50px; float:right; background-color:#FFFFFF; font-size:11pt; } #bottom{ width: 675px; clear:right; background-color:#FFFFFF; margin-top: 15px; margin-bottom: 15px; } #footer{ height:15px; width: 780px; background-color:#999999; font-family:"Arial"; font-size:10px; text-align:center; margin-top:5px; clear:right; } /*-----------BODY ELEMENTS-------*/ .subheader{ background-color:#D1A10D; font-family:"Arial"; font-size:19px; font-weight: bold; text-align:left; text-indent:5px; padding-top:5px; padding-bottom: 2px; } .pagesub{ background-color:#FFFFFF; font-family:"Arial"; font-size:16px; font-weight: bold; color:#860505; text-align:left; margin-top:5px; margin-bottom: 5px; } .column-title{ width: 190px; font-family:Arial; color: #000000; font-size: 14px; font-weight:bold; text-align: center; } div#main-container img { float:left; border: 1px solid #333; } /*------PARAGRAPH PROPERTIES-----*/ .p-main{ width:560px; margin-left:5px; padding-top:10px; padding-bottom:10px; text-align:justify; font-size:10pt; } ul{ padding-left:15px; list-style:none; } .pcolumn{padding-left: 40px;} .p-ul{font:10pt Arial;} .ptop{margin-bottom:5px;} /*----------------LINK PROPERTIES--------------*/ a:link{color:#000000; background-color:transparent;} a:visited{color:#CC0000; background-color:transparent;} a:active{color:#000000; background-color:transparent;} /*-----------RIGHT COL AND CRISP LINK PROPERTIES----*/ div#rightcol a:link{color:#000000; background-color:transparent;} div#rightcol a:visited{color:#CC0000; background-color:transparent;} div#rightcol a:active{color:#000000; background-color:transparent;} div#crisp a:link{color:#000000; background-color:transparent;} div#crisp a:visited{color:#CC0000; background-color:transparent;} div#crisp a:active{color:#000000; background-color:transparent;} /*------HTML BELOW-----*/ <body> <div id= "background-container"> <div id="listmenu"> <div id="listcontainer" class="clearfix"> <ul> <li><a href="http://www.crge.umd.edu">Home</a></li> <li><a href="#">Who We Are</a><ul> <li><a href="#">Director's Message</a></li> <li><a href="#">Staff</a></li> <li><a href="#">Faculty</a></li> <li><a href="#">Funders</a></li> <li><a href="#">Affiliates</a></li> </ul> </li> <li><a href="#">Research</a> <ul> <li><a href="#">Research Program Areas</a></li> <li><a href="#">Research Interest Groups</a></li> <li><a href="#">CrISP Research Training Program</a></li> <li><a href="#">Intersectional Research Database</a></li> </ul> </li> <li><a href="#">Publications</a> <ul> <li><a href="#">Research Connections 2007</a></li> <li><a href="#">Research Action Briefs</a></li> <li><a href="#">Campus Report</a></li> </ul> </li> <li><a href="#">Resources</a> <ul> <li><a href="#">Professional Opportunities</a></li> <li><a href="#">Alternative News Sources</a></li> <li><a href="#">Tools from Graduate Colloquium</a></li> </ul> </li> <li><a href="#">Events</a> <ul> <li><a href="#">Graduate Colloquium</a></li> <li><a href="#">QRIG Seminars</a></li> <li><a href="#">MC/VC Series</a></li> <li><a href="#">Calendar</a></li> </ul> </li> <li><a href="#">Media</a> <ul><li><a href="">Press Releases</a></li></ul> </li> <li><a href="#">Contact Us</a></li> </ul> </div> </div> <div id="header">The Consortium on Race, Gender and Ethnicity: CRGE</div> <div id="banner"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="780" height="200"> <param name="movie" value="CRGEbanner.swf"> <param name="wmode" value="transparent"> <embed wmode="transparent" src="CRGE%20banner.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="200"></embed> </object> </div> <div id="sectionright">Who We Are</div> <div id="rightcol"><p class="p-right"><b>In This Section</b></p> <p><ul> <li><a href="http://www.crge.umd.edu/about.html" target="_blank">Director's Message</a></li> <li><a href="http://www.crge.umd.edu/staff.html" target="_blank">Staff</a></li> <li><a href="http://www.crge.umd.edu/faculty.html" target="_blank">Faculty</a></li> <li><a href="http://www.crge.umd.edu/funders.html" target="_blank">Funders</a></li> <li><a href="http://www.crge.umd.edu/affiliates.html" target="_blank">Affiliates</a></li> </ul></p> <br> <br> </div> <div id="subscription"> <form method="post" action="http://www.emailmeform.com/fid.php?formid=35482"> <INPUT TYPE=hidden NAME=FCode VALUE="8gdrzytp"> <table cellpadding="2" cellspacing="0" border="0" bgcolor="#CC9900"> <tr> <td> <font face="Arial" size="2" color="#000000">Subscribe to CRGE's Listserv</font> <div style="" id="mainmsg"> </div> </td> </tr> </table> <br> <table cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF"> <tr valign="top"> <td nowrap><font face="Arial" size="2" color="#000000">Name</font></td> <td> <input type="text" name="FieldData0" value="" maxlength="100" size="20"> </td> </tr> <tr valign="top"> <td nowrap><font face="Arial" size="2" color="#000000"> Email</font></td> <td> <input type="text" name="FieldData1" value="" maxlength="100" size="20"> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td></td> <td align="left"> <input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none;"> <input type="submit" class="btn" value="Subscribe" name="Submit"></td> </tr> </table> </form> </div> <div id="logo"><p align="center"><img src="umlogo.gif"></p></div> <div id="main-container"> <p class="subheader">Director's Message</p> <p class="p-main"><img src="btdill2.jpg" width="150" height="175" />Welcome to the Web site for the Consortium on Race, Gender and Ethnicity.</p> <p class="p-main">The Consortium is an association of academic units and individual faculty on the University of Maryland campus whose mission is to promote, advance, and conduct research, scholarship, and faculty development that examines the intersections of race, gender, and ethnicity with other dimensions of difference.</p> <p class="p-main">Established in 1998 with support from the Colleges of Arts and Humanities, Behavioral and Social Sciences, the Graduate School, and the Office of the Provost, the Consortium seeks to: support, coordinate, and facilitate the activities of the many outstanding faculty and academic units at Maryland engaged in scholarship that focuses on intersections of race, gender, and ethnicity; and to build visibility both on and off-campus for our exceptional wealth of resources.</p> <p class="p-main">Through our affiliates, community partners, and research interest groups, we encourage an intellectual climate that supports collaboration. Through our Research Program Areas, we promote approaches that contextualize the lives and experiences of the individuals and groups that participate in our research. Through this Web site and other dissemination efforts, we develop applications of knowledge to human problems. Through a variety of research training opportunities we seek to transfer intellectual capital to upcoming generations.</p> </div> <div id="footer"><p>Home | Who We Are | Research | Publications | Resources | Events | Media | Contact Us</p></div> </div> </body> hi, i successfully managed to text wrap content around an image that was floated to the left (within a div element).... however, i now want an image with a caption and thus i want to text wrap the content around the div element containing the image and caption which is floated to the left... however, i cannot work out how to do this and performing a google search has not helped - can someone help me here? At http://alphaworks.co.uk/problems/non-flowing/ how can I get the three "Address line x" lines to line up under one another and not flow back to the left under the "Address:" label? Thanks, Geoff My site can be seen he pioneer.nic.edu/~mdmoffet/index.html The CSS is located at pioneer.nic.edu/~mdmoffet/church.css The problem is pretty apparent if you look at the page - the text flows down and beyond the div it is in, and the background/border of the div just randomly stops. I've put height:100% and min-height:100% in all parent elements for it, but that doesn't seem to be working as I expected it to. I'm honestly not sure what to do at this point - if the text is less than the viewport, the div will cover the full length like it is supposed to, it just seems to break at a certain length. Both my html and my css validate. Any ideas? I'm working on an experimental website at http://www.abdn.ac.uk/~u12cb4/new/ I'm trying to get the main text to flow around the divs floating at either side but as you can see it's not happening. Can anyone offer a suggestion? Thanks, Bailz Does anybody know what the css attributes would look like for the right margin divs like (e.g. #smr-00) found in this tutorial? (see link) css.image.text.wrap.tutorial.htm I use a css class to control my text around an image, but it does not print floated. Instead it prints like they are block elements. Code: img.newsthumb{ float: left; clear: left; padding-right: 5px; border: 0px; } img.newsthumb2{ float: right; clear: right; padding-left: 5px; border: 0px; } Any clue on how to fix this. Hi there I am having some trouble with my CSS dropdown menus. I have a floated div that contains a welcome paragraph and a menu that drops down. What is happening is that the menu is being drawn behind the text of the welcome paragraph (see attached image). Here are the classes... This draws the welcome text Code: #welcome { float:left; z-index:0; width : 360px; height:160px; margin-left:10px; margin-top:30px; font-size: 0.8em; } And this is the classes for the dropdown Code: .dropdownlink a { display:block; width:150px; height:19px; font-size:0.8em; color:#000000; background: url(../images/nav_drop_bg.gif) top left no-repeat; text-decoration: none; padding-left:10px; z-index:1000000000; } and this is the HTML for the menu... Code: <div id="nav_1" style="visibility:hidden; position:absolute; top: 37px; left:28px; height:100px; width:128px;"> <div class="dropdownlink"><a href="">Pain</a></div> <div class="dropdownlink"><a href="">Pain</a></div> <div class="dropdownlink"><a href="">Pain</a></div> <div class="dropdownlink"><a href="">Pain</a></div> <div class="dropdownlink"><a href="">Pain</a></div> </div> has anyone got any idea why this is ignoring the Z-index? It works in Opera, but in looks crap in IE. Is this a common problem, are there any workarounds. Please help, I'm pulling my hair out ! Before I state the problem, let me say that I am working towards properly validated html and css. There are a couple tables in my design that I put in just to show the boss something pretty! They will be gone soon. I have 3 places on the page where I'm using images as links to effect behavior with javascript or forms. My menu's going down the left side of this template has +/- "buttons" to toggle nested lists on and off. By using margin-top:-14px they are lining up slightly higher then needed in FF, slightly lower then needed in IE and way to high in Safari. If i set the margin-top to 0, then I get it lined up nicely in safari and IE and FF are off. The images inside of the <li>'s This is the css code I believe to be relevent css Code: Original - css Code .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } div.redbox img.plusminus { float:right; margin:-16px 3px 0 0; padding:0 0 0 0; height:10px; } .clearfix:after { html Code: Original - html Code <li id="item1" class="border-bottom clearfix"> <a href="/store/category/50">T-SHIRTS</a> </li> <li id="item2" class="border-bottom clearfix"> <a href="/store/category/51">PANTS</a> <a onclick="toggle('item2');"><img src="/images/closed.gif" alt="closed image" class="plusminus" class="plusminus" id="img_item2" /> </a> <ul id="ul_item2" class="closed"> <li class="sidebarsub"> <a href="/store/subcategory/325">PROTECTIVE</a> </li> </ul> </li> <li id="item1" class="border-bottom clearfix"> <a href="/store/category/50">T-SHIRTS</a> </li> <li id="item2" class="border-bottom clearfix"> <a href="/store/category/51">PANTS</a> <a onclick="toggle('item2');"><img src="/images/closed.gif" alt="closed image" class="plusminus" class="plusminus" id="img_item2" /> </a> <ul id="ul_item2" class="closed"> <li class="sidebarsub"> <a href="/store/subcategory/325">PROTECTIVE</a> </li> </ul> </li> Is this a common thing in CSS that there might be a tutorial out there on how to fix it? I've looked at using overflow and that doesn't seem to fix the problem. the link for the page... Template Thanks for having a look 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. 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> he http://www.cyclomedia.co.uk/?ie6escape.html i worked out a much better way to do this layout (no inner tables) but this bug in IE6 still persists in this version. the html and css validate so i doubt it's something i've done. kudos to anyone who can figure it out but as a note, if you add another floated div (just containing enough content to wrap e.g. "...") then it holds the image in! Hello DevShed CSS Help Forum, I have a wierd problem (seems I have a knack for that ) with a design I'm working on. When you first go to this page there is some disruption around the two floated columns in the background image that is assigned to the body tag: (Right now the page is only working in non-IE browsers, but I don't know any developers that regularly use IE anyways...LOL) http://www.spidersend.com/new_site/newsite4/test6.html However if you refresh the page or click to another tab and then back to that page it corrects itself. Once I remove the sidebar and the float property from the css on the main content area the issue is gone so it has to be something to do with that. Has anybody experienced this before? I just find it odd that it doesn't stay messed up, but corrects itself, even if you refresh and clear the cache. Confusing and wierd. Any ideas? Theories? Any and all ideas are much appreciated. Here is the CSS: Code: body { background-color: #FFFFFF; padding: 0px; margin: 0px; font-family: "arial"; background-image: url('images/bottom_slice.png'); background-repeat: repeat-x; background-position: bottom center; } div#header { background-image: url('images/header_slice3.png'); background-repeat: repeat-x; height: 198px; width: 100%; } div#header-content { width: 680px; margin: 0px auto; } div#top-navigation { width: 680px; margin: 0px auto; position: relative; bottom: 16px; color: #FFFFFF; font-family: "arial"; font-size: 16px; padding: 0px; } div#content { width: 850px; float: left; } div#content-header { background-image: url('images/content_bg_top.png'); width: 850px; height: 30px; } div#content-footer { background-image: url('images/content_bg_bottom.png'); width:850px; height: 32px; } div#content-area { background-image: url('images/content_bg_slice.png'); padding-left: 18px; padding-right: 18px; } div#adbar { width: 157px; float: right; } div#adbar-header { background-image: url('images/sidebar_top.png'); width: 157px; height: 30px; } div#adbar-footer { background-image: url('images/sidebar_bottom.png'); width: 157px; height: 26px; } div#adbar-area { background-image: url('images/sidebar_slice.png'); padding-left: 5px; padding-right: 5px; } div#sidebar { float: right; clear: both; position: relative; right: 10px; background-color: #d2e7f0; width: 300px; -moz-border-radius: 5px; padding: 5px; margin-left: 15px; color: #0c577a; } div#sidebar2 { float: right; clear: both; position: relative; right: 10px; background-color: #d2e7f0; width: 300px; -moz-border-radius: 5px; padding: 5px; margin-left: 15px; margin-top: 20px; color: #0c577a; } div#content-wrapper { width: 1007px; margin: 0px auto; } Is there any CSS to make my block of text flow between several table cells? (I know tables are a bit anti-css but I don't really have a choice here). Hi guys, i have a page of categorised links which i've wrapped using definition lists: Code: <dl class="link_category"> <dt class="category_name">Magazines</dt> <dt>XchangeIT</dt> <dd>The company through which newsagents obtain electronic magazine invoices.</dd> </dl> I would like for each list to flow after the proceeding so I've used float: left, however there's the occasional gap (see attached img). And I cant figure out whats causing this! Here's my CSS: Code: .link_category { float: left; width: 200px; text-align: left; margin: 0 20px 20px 0; } .link_category dt { font-weight:bold; } .link dt.category_name { font-size: 14px; line-height: 18px; margin: 0 0 9px 0; } Thanks in advance In Firefox, I've got a right div that is not repsonding to an auto width in FF. I am not a pro a CSS (yet ) and I hope that someone can give me the one line solution that I am missing. I've included a screen shot of the problem, any help is greatly appreciated. - K CSS Code Code: #MainContainer { float: left; width: auto; } #Main { margin-right: 0.2em; } #MainContent { padding: 0.5em 0.5em 0.5em 0.5em; } #SidebarContainer { float: right; width: 250px; border-top: 1px solid #C0C0C0; padding-top: 5px; clear: right; } #Sidebar { padding-bottom: 5px; background: #ADADAD; background-image: url(../images/SidebarBackground.jpg); background-repeat: no-repeat; clear:left; } #SidebarContent { margin: 0.2em 0.2em 0.2em 0.2em; } Hi I'm struggeling with the following: I have some span elements inside a td. If I apply padding to a span then the padding is flowing outside the td (above and below the borders of the td). Why does that happen and is there a way to make the td to autogrow to fit all the span's inside? Se example code below Code: <table border="0" cellpadding="0" cellspacing="0" align="center" style="width:300px; margin-top:50px;"> <tr> <td style="background-color:gray; text-align:center; border:1px solid black;"> <span style="margin-right:20px;">First</span> <span style="margin-right:20px;">1</span> <span style="margin-right:20px;">2</span> <span style="margin-right:20px; background-color:orange; padding:10px;">3</span> <span style="margin-right:20px;">4</span> <span style="margin-right:20px;">5</span> <span style="">Last</span> </td> </tr> </table> ******* UPDATE ******* I found this link today: http://css-discuss.incutio.com/?page=FormattingContexts which says (among other things): ************************* Only one thing impacts the vertical space between inline elements: the line height. Normally, the line height is based upon the line height for the text in that line, or the height/padding/border/margin of any replaced items. The element on a line with the largest line height or replaced height is the one to define the vertical space that line takes up. Height, padding, border or margins on text do not impact the line height or the container height. Instead, borders, padding and margins overlap from line to line. If you want to give an inline text element some padding and border, make sure you give it some extra line height, too, or else it will overlap with whatever else is above or below it. ************************* So does that rule mean that I have no way to make my TD autogrow in relation to the padding applied to the SPAN in the example above? Is there any working workarounds for this...? Good Morning All, Been having a slight problem with the visual in the screenshot below. The blue line is our H2, and the purple one is our H3, however, as you can see, the underline spans the entire width of the column, not just underneith the text, which is our requirement. ***As i am not allowed to upload a url as a new user, the underline is as follows. With the text centre aligned. text ----------------------------------------------------------- rather than text ------ and obviously by the css, the underline on the headers is a small image, repeated - x. Please see relevant css information. * (line 23) { margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0pt; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 0pt; } h2, h3, h4, h5, h6 (line 101) { font-size: 1.2em; font-weight: normal; padding-bottom: 4px; margin-top: 0.6em; margin-right: 0pt; margin-bottom: 0.8em; margin-left: 0pt; text-align: center; } .contentArea h2, #secondaryNavigation h2 (line 114) { background-color: transparent; background-image: url("../images/h2_gradient_bg.gif"); background-repeat: repeat-x; background-attachment: scroll; background-position: left bottom; color: #0066cc; } Many Thanks in advance. Marc. Hi. See code below. Why does the outer SPAN in TABLE not grow with the image height. If the text is longer so it is forced below image then it looks as it should. Please also read some comments in the code. Code: <html><body><center><br><br> Why does image not force the outermost span to be at least as high as image?<br> If the text are long enough and gets below the bottom border of image it look good though.<br><br> NOTE: I need to put Image and text either within separate span or in same span as the examples below.<br> In my real application I'm using an <a href=" ...> around the outer span in examples below.<br> <br><br> <table border=1 cellpadding=0 cellspacing=0 width=200px><tr><td> <span style="display:block; background-color:#ffa827; padding-top:10px; padding-left:10px; padding-right:10px;"> <span style="display:block; float:left"> <img src="landscape.jpg" height="40px" width="40px" alt="" border="0"> </span> <span style="display: block; color: white;"> Text here. </span> </span> </td></tr></table> <br><br> <table border=1 cellpadding=0 cellspacing=0 width=200px><tr><td> <span style="display:block; background-color:#ffa827; padding-top:10px; padding-left:10px; padding-right:10px; color: white;"> <img src="landscape.jpg" height="40px" width="40px" alt="" border="0" style="float:left"> Text here. </span> </td></tr></table> </center></body></html> Hi. Really hoping someone can help me with this... I'll try and explain this as best I can(!) Basically I've got a page containing a block of 9 images, with each linking to a video clip. At the moment I've got the CSS coded so that whenever the mouse is hovered over the 'infobar' (at the bottom of each image) it goes from having a transparent background with black text to having a grey background with white text. What I'm trying to achieve is that same effect whenever the mouse is hovered over any part of the image and infobar. The live online link can be found at: www.markmcm.co.uk/test/test.html The CSS is as as follows: Code: /* * Page Stylesheet */ body { font-family: Arial, Helvetica, sans-serif; background-color: #eaeaea; border:0; margin:0; padding:0; height: 100%; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } #container { margin-left: auto; margin-right: auto; min-height: 100%; width: 936px; } * html #container { height: 100%; } #content { float:left; position: relative; height: 528px; width: 936px; z-index: 0; } .miniscreen1, .miniscreen2, .miniscreen3, .miniscreen4, .miniscreen5, .miniscreen6, .miniscreen7, .miniscreen8, .miniscreen9 { position: absolute; float: left; display: block; width: 312px; height: 176px; } .miniscreen1 { top: 0; left: 0; } .miniscreen2 { top:0; left: 312px; } .miniscreen3 { top: 0; left: 624px; } .miniscreen4 { left: 0; top:176px; } .miniscreen5 { left: 312px; top:176px; } .miniscreen6 { left: 624px; top:176px; } .miniscreen7 { left: 0; top:352px; } .miniscreen8 { left: 312px; top:352px; } .miniscreen9 { left: 624px; top:352px; } .info { height: 30px; top:3px; left: 40px; width: 265px; float: left; position: absolute; } .infobar { left:0px; position: absolute; top: 140px; width: 312px; height: 36px; outline: none; color:#000; background: url("data/infobar.png") no-repeat 0 0; z-index: 650; } .infobar:hover { background-position: 0 -36px; outline: none; color:#fff; } #infobar span { display: none; outline: none; } .clip_title { outline: none; font-size: 85%; font-weight: 700; vertical-align: top; text-align: left; } .clip_sub { outline: none; height: 13px; font-size: 80%; line-height: 13px; font-weight: 700; vertical-align: top; text-align: left; } And the HTML is: 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"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Page</title> <meta name="description" content=" " /> <meta name="keywords" content=" " /> <meta name="generator" content=" " /> <link rel="stylesheet" type="text/css" href="page.css" media="screen" /> </head> <body> <div id="container"> <div id="content"> <span class="miniscreen1"> <a href="#"> <img src="img/clip1.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 1<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen2"> <a href="#"><img src="img/clip2.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 2<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen3"> <a href="#"><img src="img/clip3.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 3<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen4"> <a href="#"><img src="img/clip4.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 4<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen5"> <a href="#"><img src="img/clip5.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 5<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen6"> <a href="#"><img src="img/clip6.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 6<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen7"> <a href="#"><img src="img/clip7.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 7<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen8"> <a href="#"><img src="img/clip8.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 8<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen9"> <a href="#"><img src="img/clip9.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 9<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> </div> </div> </body> </html> There must be a better (and easier?) way to do this. Any help would be very-much appreciated - and save an old bloke from tearing too much of his hair out(!) |