CSS - Line-height Issues In Ie, Works As Expected In Firefox
I'm trying to control the line-height of a list element. I've tried percentage, numbers, and points, without much luck. I'm trying to decrease the vertical spacing between each list element and can successfully do so in Firefox with the line-height property, but when it's viewed in IE, the bottom half of the characters get cut off. Is there a better method to do this in IE?
Thanks! Similar TutorialsIt displays fine in firefox, but not in IE. I haven't done anything personally with websites since php was first coming out, so css is completely new to me and Im using a (now modified) template instead of from scratch. So any help would be great. WARNING: Linked site is not work-safe Site is at 'razornow.comlu.com' css code is: Code: body { font-family: tahoma, helvetica, arial, sans-serif; font-size: 10px; text-align: center; background: #000000; margin: 0px; padding: 10px; } html, #wrapper, h1 { margin: 0px; padding: 0px; } img { border: 0px; } #wrapper { margin: auto; text-align: left; width: 710px; position: relative; } h1, h2, h3 { font-size: 10px; } h1 { line-height: 1; position: absolute; top: 0px; left: 0px; } h2 { margin: 0px 0px 5px 0px; padding: 0px; } h3 { padding: 4px 0px 0px 0px; } .block { display: block; } .clear { clear: both; height: 10px; } .left { float: left; margin: 5px 20px 0px 0px; } .right { float: right; margin: 0px 0px 0px 20px; } .readmore { text-align: right; } /* page structure */ #wrapper { background: url(images/body_t.gif) top no-repeat; padding-top: 20px; } #body { background: url(images/body_bg.gif) repeat-y; padding-bottom: 10px; } #body p { background: white; } #nav { position: absolute; top: 25px; left: 253px; width: 450px; height:35px; background: url(images/nav.gif) repeat-x; } #nav ul{ padding: 0px; margin: 0px; list-style-type: square; list-style-position: inside; } #nav li{ padding: 7px 16px 0px 16px; margin: 0px; height:35px; list-style-type: square; list-style-position: inside; float:left; border-right: 1px solid #FFFFFF; display:inline; } .lastchild{border-right: 0px none #FFFFFF !important;} #nav a{ font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; text-transform: capitalize; color: #FFFFFF; text-decoration: none; } #nav a:hover{ color:#fcff85; } #current { float: left; width: 235px; margin-left: 10px; margin-top: -10px; background: url(images/menu_bg.gif) repeat-y; border-bottom: 1px solid #05256b; } * html #current { margin-left: 5px; } #content { float: right; width: 450px; padding-top: 40px; margin-right: 8px; } * html #content { margin-right: 4px; } #footer { background: url(images/body_b.gif) no-repeat; text-align: center; padding-right: 10px; padding-left: 480px; padding-bottom: 30px; } #copyright { position: relative; top: -8px; color: #989898; } /* current column */ #current .nav { margin: 21px 6px 5px 5px; } #current ul { border: 1px solid #8497c2; margin: 0px; padding: 0px; } * html #current ul { padding: 3px 0px; padd\ing: 0px; } #current li { list-style: none; border: 1px solid #4e698f; background: #01285f url(images/harry.gif) left center no-repeat; padding: 0px 0px 0px 20px; margin: 3px; } #current li.readmore { text-align: right; background-image: none; } #current ul a { color: #beddff; text-decoration: none; display: block; padding: 3px 12px 3px 0px; } * html #current ul a { width: 100%; w\idth: auto; } #current ul a:hover { color: white; } #current .readmore { padding: 3px 4px 4px 20px; } * html #current .readmore { padding: 0px 4px 1px 20px; padd\ing: 3px 4px 4px 20px; } #current .readmore a { text-decoration: underline; display: inline; } #currenttitle { position: absolute; left: 15px; top: 409px; } * html #currenttitle { top: 411px; } /* page content */ #content h2 { line-height: 1; margin: 0px; padding: 20px 0px 0px 0px; } #content h3 { margin: 10px 0px; padding: 0px; text-transform: capitalize; } #content p { margin: 10px 0px; padding: 0px; } #content .contentbox { border: 1px solid #e1e1e1; border-top: none; padding: 5px 20px 10px 20px; } * html #content .contentbox { padding-bottom: 11px; } #content, #content a { color: #868686; } #content a:hover { color: #000; } I have a div in my header that contains an image. The height of the image is 82px. For some reason in firefox (and chrome too) if I don't set the div height to 125px it gets cut off. It looks OK in IE6 without the height set, but with it set as needed for firefox it then creates a space in IE. My header file has: Code: <div id= "logo" ><img src = "images/logo_LWV.gif"></div> <div id = "topNav"> <div id = "topNavMenu"> <a class = "top" href="index.php">Home</a> <a class = "top" href="about.php">About Us</a> <a class = "top" href="join.php">Join</a> <a class = "top" href="funds.php">Special Funds</a> <a class = "top" href="contact.php">Contact</a> </div> <!-- end topNavMenu --> </div> <!-- end topNav --> </div> <!-- end topBar --> <div id = "imagebar"><img src = "images/lwvCorvallis.jpg"></div> <div id = "greenbar"> <div id = "pagetitle"> <p>Title</p> </div><!-- end pagetitle --> </div> <!-- end greebar --> and the css is: Code: #topbar { dispaly:block; width: 800px; } #logo { float:left; } #topNav { float:right; width: 612px; height: 65px; background-color:#cc0033; } #topNavMenu { position:relative; top:40px; text-align:left; color: white; } #imagebar { display:block; width: 800px; height:125px; } #greenbar { display:block; width: 800px; height: 90px; background: url(images/greenbar.jpg); background-repeat: no-repeat; z-index: 0; } #pagetitle { position:relative; left: 200px;top:25px; width: 600px; color: white; z-index: 1; } The site is he http://www.lwv.corvallis.or.us/ What's going on? The problem I have has arisen whilst trying to create a horizontal and a vertical navigation menu using <li> tags. It is best illustrated by the following example: Code: <div style="width:100%;height:50px;"> <ul> <li style="border:1px solid black;">Hello</li> <li>World</li> </ul> </div> <br /> <div style="width:100px;height:100%;"> <ul> <li style="border:1px solid black;">Hello</li> <li>World</li> </ul> </div> and the CSS Code: div { border:0; background-color:#888888; } ul { margin:0;padding:0; } ul li { float:left; list-style:none; background-color:#CCCCCC; height:50px; width:100px; } The <div> tags are set to 50px height and 100px width respectively. When an <li> element is placed within the div with the same height or width they display the way I intended. However once a 1px border is applied to the <li>'s then in IE the border is counted as part of the width or height. In Firefox the border will add 2px to the starting height and width giving the effect of width:102px or height:52px;. This is massively frustrating as I need each <li> to have the 1px border. It looks different in each browser (I have not tested it in netscape nor opera, but I suspect they will display the same as Firefox.) Can anyone provide a fix to get get round this please? Thank you in advance. Hi all, I am trying to automate everything on my test website and I have one more angle to cover. In effect, I want to adjust the line-height property (which I can do) based on the number of files within a specific folder (PHP and already done). The more files in the folder, the lower the line-height value must be. This is to ensure if I copy additional files into the folder, then the navigation menu (which is PHP reading files in this particular folder) will alter the CSS line-height property accordingly to ensure it can never exceed a certain height. Sounds wierd? go to www.re3.org.uk (next to the RE3 image, I have a list of hyperlinks which are obtained from files within the folder) My problem, when adjusting the CSS property (which is set as cm in *.css file) in javascript, it doesn't correspond correctly, the line-height property in javascript doesn't appear to be work in cm but some other measurement. Does anyone know how to change what unit of measurement Javascript works in? Or does anyone know what unit of measurement javascript uses when adjusting line-height / line-width values? I want to create a mini-algorithm that works out the appropriate line-height based on the image height (got that already) and the number of files in the folder (got that too) so the menu automatically adjusts to fit. Whew! Hello Just recently I had an idea for a page I wanted to make, the design is basically a 3-column layout with no traditional header or footer, the height of all three columns should run the length of the window/page height the left and rightmost column would have a fixed width or a width in em, the center column width should fill the space in between. If the content is short all columns should extend to the height of the page window, but if the content in any of the columns is longer than the window height they should all extend to reach the bottom of the page and accommodate the content length In my first attempt things didn't go so well, results varied wildly across browsers so I decided to start from scratch bit by bit Bellow is the point at which I reach consistent but undesired behaviour, I have validated and tested the code in Firefox 3/Pale Moon, Internet Explorer 8, Chromium 9, and Opera 11 I would like the end result to work in the above browsers as well as IE7 if possible I should point out now that im not interested in using faux-columns, the layout should not require images, I also wish to have absolute-positioned elements in the columns some time later 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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Three Columns</title> <style type="text/css"> *, html, body { margin: 0; padding: 0; font-size: 100%; } html, body { width: 100%; height: 100%; } #maincontainer { position: relative; height: 100%; background: #eee; } #left { position: absolute; top: 0px; left: 0px; width: 200px; background: #fbb; height: 100%; } #mid { position: relative; margin: 0 200px 0 200px; background: #efe; height: 100%; } #right { position: absolute; top: 0px; right: 0px; width: 200px; background: #bbf; height: 100%; } </style> </head> <body> <div id="maincontainer"> <div id="left"> left start<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left end<br /> </div> <div id="mid"> mid start<br /> mid<br /> mid<br /> mid<br /> mid<br /> mid<br /> mid end<br /> </div> <div id="right"> right start<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right end<br /> </div> </div> </body> </html> In the above example it works as long as the content within the columns is shorter than the window height, but if you re-size the window so that the text in the right or left column goes beyond the page, and then scroll to the bottom, the columns do not extend to the bottom of the page so there is a large gap where the content overflows beyond the column What I would like to do from this point is make the columns extend to the bottom of the page when this happens, but I'm not sure how best to proceed I also have a version of the above code which uses floated left and right columns instead of absolute positioned ones, would it be better to work from that? or does it not really matter Thanks in advance I cannot figure this out. I've tried adding clear: both in several places, I've tried overflow: hidden and I've tried cursing. Nothing works! How can this be fixed so that in IE6 the divs are not staggered vertically?? Code: <div style="height: 38px; margin: 0px; padding: 0px; width: 140px;"> <div style="float: left; height: 38px; width: 38px;"><img style="border: 1px solid #444444; vertical-align: middle" src="http://www.diversifieddesigns.com/GRAPHICS/Spacer.gif" alt="" width="38" height="38" border="0"></div> <div style="float: right; height: 38px; width: 102px;">copy</a><br>copy</a></div> </div> <div style="height: 38px; margin: 0px; padding: 0px; width: 140px;"> <div style="float: left; height: 38px; width: 38px;"><img style="border: 1px solid #444444; vertical-align: middle" src="http://www.diversifieddesigns.com/GRAPHICS/Spacer.gif" alt="" width="38" height="19" border="0"></div> <div style="float: right; height: 38px; width: 102px;"><img style="border: 1px solid #444444; vertical-align: middle" src="http://www.diversifieddesigns.com/GRAPHICS/Spacer.gif" alt="" width="38" height="8" border="0"></div> </div> Greetings, I have a class called "header" and I am trying to give it a touch of extra space between it and the next line. All of my headers are just a few words and thus on one line. I tried placing "line-height: 1.5em" in my "header" class and it shows up correctly in Dreamweaver but not in IE. My thought is, because it is only a single line, that class value does not kick in because there is no second line for that class. Is there a way to conrol this in CSS or am I going to have to resort to using a....gulp.....spacer? Thanks in advance! I've got two lines of text. Want the spacing the two lines to increase, so I set a line-height. When I do this, not only does it increase space between the two lines, it also increases spacing above the first line (and maybe below the second). How can I increase spacing between the two lines only, without increasing above and below? Thanks! Hi all, I have come back to designing websites after a long time and I am having problems making the height auto work in firefox. The css code: Code: div.t2_container{ width:679px; height:auto; text-align:left; padding-top:10px; padding-bottom:10px; background:#e7e7e9; } div.t2_col1{ float: left; width:470px; height:auto; display: inline; clear:both; background:#FFFFCC; } div.t2_col2{ float: right; width:199px; height:auto; display: inline; background:#CCFFFF; } and the html: Code: <body> <div class="t2_container"> <div class="t2_col1"><p>text text</p><p>text text</p><p>text text</p></div> <div class="t2_col2"><p>text text</p><p>text text</p><p>text text</p><p>text text</p></div> </div> </body> IE recognizes the height = auto on the container div and resizes so that the inner divs are contained within the grey bounding box of the container. However firefox does not recognize this and the 2 inner divs fall outside the container which is left hanging thin at the top. Does anyone know a fix for this pls? Thanx I have a tag which pulls down from the .p tag. What I was looking to do is, just remove the top margin from my custom tag. The result is, the first line indents but does not for the rest of the paragraph. Any suggestions??? p { font-size: 11px; margin:10px 10px 10px 10px; line-height: 140%; color:#333333; } .table_content { font-size: 11px; margin-top: 0px; } Hi, I have this simple sample: <div style="width: 50px; height: 100px; text-align: center; background-color: teal; line-height: .7em"> <span style="padding: 0; margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 10px; ">Here are some words that should wrap</span> </div> You can see in IE that the space between "should" and "wrap" is greater than the space between the other lines. Why is that? Also, the line height in this sample in IE and FF are different, FF has a bit more space than IE. I cannot measure em, so I don't know which is right. Is there any documentation on this difference? Thanks in advance, CJB Hope this is a simple prob for you css gurus. This time I can just direct you to a public site http://tixrus.us Attention to the "On Sale Now" list at the left, I chose a small font to list the dates. I would like that teaser of the next 5 events in chron to be a little more compact. I have tried setting the line-height directly but nothing seems to change. I used style= in the source so it will be easy to find it. How can I make those more compact. Also the client list and the text in the search box. Thanks! Hope this is a simple prob for you css gurus. This time I can just direct you to a public site http://tixrus.us Attention to the "On Sale Now" list at the left, I chose a small font to list the dates. I would like that teaser of the next 5 events in chron to be a little more compact. I have tried setting the line-height directly but nothing seems to change. I used style= in the source so it will be easy to find it. How can I make those more compact. Also the client list and the text in the search box. Thanks! I'm having trouble making the line-height work the way I want to in IE. I set the line-height of the outer container to this tag cloud to 24px, yet on IE it doesn't seem to be working. Any Ideas? Check it out. http://gifdump.com/tags/ Viewed on Firefox Viewed on IE I'm encountering a stange problem with line-height in ie6 when my unordered list is wrapped in a div. Firefox displays the correct line-height but ie6 seems to double it. How can I fix this so ie6 looks like ff? Thanks for any help! 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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <style> ul { list-style: none; width: 192px; margin: 20px 0px 0px 70px; line-height: 2em; padding: 0px; } li a:link, #nav li a:visited{ display: block; color: #3e4735; text-decoration: none; position: relative; } li a:hover { color: #6d7e59; text-decoration: underline; } </style> </head> <body> <div id="nav"> <ul> <li><a href="#">Lorem ipsum dolor sit</a></li> <li><a href="#">Lorem ipsum dolor sit</a></li> <li><a href="#">Lorem ipsum dolor sit</a></li> </ul> </div> </body> </html> Question) In CSS can you line-height be set to a lower value than the current font size? What does this cause? potential answers (practise revision exam are) A) line-height cannot be set to a value lower than the current font size B) The lines are cut to prevent overlapping C) The lines will overlap I am pretty sure they overlap but want to confirm Hi all, hope someone can help with this. Page with problem: html Code: http://central12.com/hovv.htm CSS Code: http://central12.com/hov.css Basically I used Eric Meyer image pop up tuturial, got it working ok in firefox, but in IE when I hover over the link the text jigs down a bit. I know I can stop this by removing the line-height attribute on the p tag, but wanted this to remain as it is a style I want across the site in general. Any way to keep the line height and remove the IE text jog. Thanks for any help. I'm using the following code: <font style="font-family:Verdana; font-size:10px; line-height: 70%; color: rgb(153, 153, 153);"<br />Photo Caption Goes Here</font> And it doesn't seem to be cross-browser compatible. The photo caption seems to publish differently across multiple browsers. I like how it's displayed in Firefox but on other browsers the photo caption is partially displayed or the line height is too close together. What's the best way to add css to a <font style=""> so it's cross browser compatible? Or does this have something to do with other styles on the page? Hello, sorry to post another problem but I am trying to give my website a minimum height and it's just not working. I have written body {min-height:100%;} and even put html.body{min-height:100%} then i've created a container with min-height 100% and it doesn't create anything. So I changed it to #container {min-height 768px;} and put everything inside that div. This creates a box 768px high but doesn't extend when the content goes beyond that. to view this please visit #www. wheretoflyguide .com# and click 'add entry'. you will see that the content_area div which holds the main component extends down but the wrapper doesn't. The hideous colours are for illustrating the problems rather than design taste! Appreciate your help. |