CSS - Space Between Background And Border In Ie
i have a div named #main that contains #content(float:right), #sub(float: left), and #footer(clear:both). In IE, #main's background color doesn't stretch all the way through #footer, even though a bottom border applied to #main displays below #footer. So there's a space between the background and the border!
#main's background is brown/grey, and botom border is 1px green. What gives? http://www.nomadicamedia.com/temp/ Similar TutorialsHi all, Great forum page with problem, good in firefox, bad in ie, http://www.central12.com/photosmain1.htm The images as displayed in ie appear with a small gap at the bottom of the picture. I have condensed the code, can't figure it, but using lists to layout images is new to me. Would have used individual divs previously, but have seen this technique used and it seems better, less code. I think i'm just missing a simple fix, as images and boxes are set to the same dimensions. The code in the example differs from the code on the uploaded page, been on it for a week still trying to suss it. HTML: Code: <link href="test.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="mainpic1" class="big4"></div> <div id="sidepic1"> <ul> <li class="piccys1"><a href=""><img alt="British Monuments" title="British Monuments" src="picsthums/castlehill.jpg" width="95" height="80" /></a></li> <li class="piccys1"><a href="photos.htm"><img alt="Canada" title="Canada" src="picsthums/canlake.jpg" width="95" height="80" /></a></li> <li class="piccys1"><a href=""><img alt="Plants/Flowers" title="Plants/Flowers" src="picsthums/portplant.jpg" width="95" height="80" /></a></li> <li class="piccys1"><a href=""><img alt="France" title="France" src="picsthums/francechurch.jpg" width="95" height="80" /></a></li> <li class="piccys1"><a href=""><img alt="Ievissa" title="Ievissa" src="picsthums/rockyibiza.jpg" width="95" height="80" /></a></li> </ul></div> <div id="sidepic2"> <ul> <li class="piccys"><a href=""><img alt="Sunsets" title="Sunsets" src="picsthums/safricasun.jpg" width="95" height="80" /></a></li> <li class="piccys"><a href=""><img alt="Architecture" title="Architecture" src="picsthums/majorchurch.jpg" width="95" height="80" /></a></li> <li class="piccys"><a href=""><img alt="Mountains" title="Mountains" src="picsthums/olympos.jpg" width="95" height="80" /></a></li> <li class="piccys"><a href=""><img alt="British Countryside" title="British Countryside" src="picsthums/harbscot.jpg" width="95" height="80" /></a></li> <li class="piccys"><a href=""><img alt="Ancient" title="Ancient" src="picsthums/sphinxthum.jpg" width="95" height="80" /></a></li> </ul></div> </body> </html> CSS: Code: /*Main styles----*/ body { margin: 0px; padding: 5px 0px 5px 0px; background-attachment: fixed; background-color:#000; } img{ border: 0 none; } #mainpic1 { width: 479px; height: 323px; margin:24px 0 15px 10px; float:left; } li.piccys, ul.piccys { float:right; width:95px; height:80px; margin:9px 0 0 5px; padding:0px; list-style:none; border:2px solid #fff; } li.piccys1, li.piccys1 { float:right; width:95px; height:80px; margin-top:9px; margin-right:5px; padding:0px; list-style:none; border:2px solid #fff; } #sidepic1 { width: 100px; height: 480px; margin-top:15px; margin-right:5px; float:right; } #sidepic2 { width: 100px; height: 480px; margin-top:15px; margin-right:35px; margin-left:0; float:right; } Thanks for your time, I expect there are loads of ways I could do it better, your advise is appreciated. Paul Hi All, I am trying to make my table do the attached, where it has a border around the entire table but has a 2px space edge... Like the attched image, any ideas? Maybe I should be posting this as a reply - this is an UPDATE: I used the WC3 Validator and it found an outright error in my code. So, gosh - ignore the posting below! And, uhm, I think I'll be using that handy-dandy WC3 tool more often.... ---------- Okay - I am a CSS dope - I've been using tables and antiquated code for a long time. I'm putting together a dummy site, just for testing, and I'm trying to postiion things with DIVs, etc. Be gentle - I'm 59, and, not that damned smart... I installed Dreamweaver and have been fooling with that as it has a lot of templates with proper CSS, tips, etc. But I've never used it before, so that's another learning curve. So, I have a page on which there are some DIVs and, in one, there is an extra space - and, an extra bottom border line - in Internet Explorer. I'm not fond of IE, but that isn't the point - a lot of people use it.....and I need to know why this is happening. Here's a link to an image of what it looks like in Explorer - the line at the bottom is absent in Firefox and Chrome: Screenshot The page is just the index page at: GuyMerritt.net The CSS files looks like this: Code: body { margin: 0 0 0 0; background: #FEFEEC; height: 1000px; background: #F9F9EE; } h2 {font-family: tahoma; font-size: 12px; font-weight: normal; padding-left: 5px; padding-right: 8px; color: #777772;} #header {height: 220px; background: url(../images/header_graphics.jpg); } #left-sidebar { float:left; width:20%; padding-left: 20px; } #right-sidebar { float:right; width:20%; padding-right: 20px; } #main-content {width: 54%;float: left;padding-top: 0px; } .sidebars-2 #content { width: 54%;float: left;padding-top: 10px; } #box { border-style: solid; border-width: .05em; font-family: arial; color: #777772; font-size: 13px; padding-left: 9px; padding-right: 9px; } img.example { width: 100%; max-width: 250px; height: auto; } div#slides { width: 500px; height: 280px; overflow: hidden; } div#slides div { height: 280px; width: 500px; font-size: 100px; line-height: 200px; text-align: center; color: #fff; } ul#ticker { height: 1.4em; overflow: hidden; border: solid 1px #aaa; background: #ccc; } ul#ticker li { padding: 0.2em 0; } /* @group global */ p#links { padding-top: 50px; clear: both; } a#avatar { position: absolute; bottom: 10px; right: 10px; } a#avatar img { border: none; } h1 { color: #0094d5; } a { color: #0094d5; } a:visited, a:hover { color: #00577e; } .red { background: #e40053; } .blue { background: #0094d5; } .green { background: #43aa38; } /* @end */ At the rate I'm moving, I'll be dead before I ever figure this stuff all out! If anyone could explain what's causing this I would be very grateful. And why do so many things render differently in Explorer (from Chrome and Firefox)? Thanks again, Guy Merritt, Flint, MI Misalignment - white space in IE 8 Hi Not able to find the cause of the spaces in IE8. works perfect in FF http://tinyurl.com/26resg9 The same code on different website works fine in both IE8 and FF http://tinyurl.com/y9hvmmw I know the problem is somewhere here in main.css file Code: .content-wrap{ background:url(watermark.jpg) no-repeat; width:1000px; margin:0 10px; padding:0; } Can someone help? Hi, I just was wondering if there is a way to load an image as background of a div with a 1px padding from the border of that same div. At the moment I have to create two divs. The first div has the border and a padding of 1px and the second div loads the image as background! However I was wondering whether I could do all this in one. Regards, Sim085 Hi: I recently posted this issue (http://forums.devshed.com/css-help-116/border-image-problems-with-ie-312603.html) and got half the problem solved. I have an image as the background of a <td> tag. Also I have a border-top and border-bottom surrounding the image. My problem is that in IE, the borders are not lining up agains the image. They are a pixel away, which screws up my tabs. CSS: Code: html, body { margin: 0px; padding: 0; background: #EEF; font: 11px/13px Verdana, Arial, Helvetica, sans-serif; color: #000; } table#main { margin: 3px; padding: 3px; width: 99%; } #header { background: #FFF; background-image: url(include/head.jpg); background-repeat: no-repeat; height: 136px; width: 100%; background-position: right top; border-top: 1px solid #999; border-bottom: 1px solid #999; } #nav { margin: 0; padding: 0; position: absolute; top: 125px; float: left; } #nav li { list-style: none; float: left; margin-left: 4px; padding-left: 15px; font-size: 10px; line-height: 17px; white-space: nowrap; background: url(include/tab.gif) 0 0 no-repeat; border-bottom: 1px solid #999; } #nav a { display: block; float: left; padding: 0 16px 0 0; text-decoration: none; background: url(include/tab.gif) 100% 0 no-repeat; color: #999; width: .1em; } html>body #nav a {width: auto;} /* fixes IE6 hack */ /* Commented Backslash Hack hides rule from IE5-Mac \*/ #nav a {float: none;} /* End IE5-Mac hack */ #nav a:hover {color: rgb(62%,35%,22%);} #nav #current, #nav #current a { color: #FDB; background-image: url(include/tab.gif); } .title { font: bold 24px/26px "Times New Roman", Times, serif; color: #000; display: block; margin-left: 4px; } The pertinant declaration is the #header id. I used the background-position: right top as was suggested which solves the the problem at the top, but now there are two pixels separating the image and the border on the bottom! Please help! As a side note, this works perfectly in Firefox (of course). If any other info is warranted, please let me know! The link to the page is: http://www.wiu.edu/users/mujas2/test/ Here's the code. Code: <div class="entry"> <p>Blah blah blah</p> <div class="postmetadata"> <div class="hide"> Blah blah blah </div> Blah blah blah </div> And the CSS. Code: #content div.post div.entry { float:left; margin:-5px auto auto 6px; width:570px; font-size:12px; line-height:20px; } #content div.post div.entry p { margin:0; padding:0; background:white; } #content div.post div.entry div.postmetadata { margin:10px auto 20px auto; font-size:11px; line-height:19px; border-top:1px solid #bcbcbc; } #content div.post div.entry div.postmetadata div.hide { display:none; } Apparently I have to set background:white; to the #content div.post div.entry p for div.postmetadata's border-top to appear in IE7. Firefox and IE8 displays this correctly. Any ideas? i'm trying to style my submit button to have a gradient background with a solid blue border. looks awesome in FF, however when I try to apply the background image to the submit button in IE (6 and 7), there will be an extra border inside of the blue border. it seems to be whatever color i set my background-color to. Code: border: 1px solid #69A2CC; background: transparent url(gradient.jpg) no-repeat scroll 0 center; Hi. Have created some simple tabs using table cells. Active tab should have bottom-border color equal to page background-color. Non-active tabs should have bottom-border=black. Works fine in IE, but does not work very well in Firefox. If I remove the border-collapse:collapse on the table, then firefox also work... but I would like to be able to keep the 1px border between each table cell. So is there a way to make this work in both IE and Firefox... and hopefully most other browsers... See code below: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <style type="text/css"> a.menu_top:link {color: #000000; text-decoration: none;} a.menu_top:visited {color: #000000; text-decoration: none;} a.menu_top:hover {color: #000000; text-decoration: none;} a.menu_top:active {color: #000000; text-decoration: none;} td.menu_top_passive { background-color: #777; border-left: 1px #000000 solid; border-right: 1px #000000 solid; border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; text-align: center; cursor:pointer; font-weight: bold; padding: 5px 20px 5px 20px; margin: 0; } td.menu_top_active { background-color: #bbb; border-left: 1px #000000 solid; border-right: 1px #000000 solid; border-top: 1px #000000 solid; border-bottom: 1px #bbb solid; text-align: center; cursor:pointer; font-weight: bold; padding: 5px 20px 5px 20px; margin: 0; } </style> <script language="JavaScript"> function change(id, url) { for (i=1; i<6; i++){ eval("document.getElementById("+i+").className='menu_top_passive'"); } eval("document.getElementById("+id+").className='menu_top_active'"); } </script> </head> <body style="margin:0; padding:0; background-color:#bbb;"> <br><br> <center> 1. Load the page.<br> 2. Click Item 4.<br> 3. Click Item 2.<br><br> Why is the bottom border of the menuelements (table cells) not getting correct in Firefox?<br> None-active menuelements should have a border-bottom = black, active should have same bottom-border as page.<br> Notice that I use border-collapse on the table in order to get the cell-border 1px thick between the menuitems.<br> If I remove border-collapse, then there is no strange behaviour in Firefox.<br> Any way to get this working in Firefox without breaking it in IE? </center> <br><br><br> <table border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse:collapse;"> <tr> <td id="1" nowrap class="menu_top_active" onClick="change('1');"><a href="javascript:;" class="menu_top">Item 1</a></td> <td id="2" nowrap class="menu_top_passive" onClick="change('2');"><a href="javascript:;" class="menu_top">Item 2</a></td> <td id="3" nowrap class="menu_top_passive" onClick="change('3');"><a href="javascript:;" class="menu_top">Item 3</a></td> <td id="4" nowrap class="menu_top_passive" onClick="change('4');"><a href="javascript:;" class="menu_top">Item 4</a></td> <td id="5" nowrap class="menu_top_passive" onClick="change('5');"><a href="javascript:;" class="menu_top">Item 5</a></td> </tr> </table> </body> </html> I'm a little puzzled by this weird display bug by IE7, this bug doesn't occur in IE6. It had to do with the DIV's CSS's border-style. If you set it to double then you notice some random bugs with it. Some of the time, the border is displayed without a problem. Some of the time, it is displayed with some gaps in the line as if it is not being drawn upon. Some of the other time, it is not displayed at all. I noticed if I switch from one tab to another then back, the border appeared as if nothing had happened. I also noticed that if I open the view source that overlapp the web browser then closed it, the border appeared as if nothing had happened. How do you fix that problem? Thanks... Hi, This used to be my solution: Code: <table border=1 bordercolorlight='#CCCCCC' Bordercolordark='#FFFFFF'> But this only works well on IE - not Mozilla Now I want to use CSS: Code: .results { border: 1px solid #CCCCCC ; } Code: <table class='results'> --------------- The problem is, with CSS, only the TABLE acquires the border property. The cells within it don't. If I specify Code: <td class='results'> for all the cells in the table, this also won't work, because the cell borders overlap each other and some border lines seem thicker than others (because of overlapping). Is there any simple way I can specify the border property for the table - in ONE declaration? I want the table and td borders all to be a simple 1px width ...is that possible in one declaration? Thanks a lot! I would like to set up a table with a different border than the cells inside it. Here's my 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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> TABLE {border: 1px solid black; border-collapse: collapse; width: 200px} TD {border: 1px solid #ccc} </style> </head> <body> <table> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> That's all hunky dory in (gasp!) IE, but good browsers...they only show the lighter gray color. How do I get the table border to be different? How do you create an inner border around a table in css, rather than a "solid" border which creates a border line around the table on the outer half. The border needs to butt up against an image, rather than leaving a pixel space. This is the coder I have so far. Nothing big: Code: .solid { border: solid 1px #000000; } Thanks. I have a div with a background color set, that I want to have slightly transparent. Inside that div, is essentially my entire website. Now if I apply the opacity to the main outer div, all the divs inside inherit that transparency. Any ways to get around this? The outer Div with the transparency is the "content_wrapper" div. It excludes the header and footer. So the only issue is correcting everything wrapped inside the "content_wrapper" and "content" div. I tried setting the "content" div to opacity: 1; but it had no effect whatsoever. http://www.area51entertainment.co/index.php?about So I have a design where the background is a large (1400x1100) image that fades into a vertical gradient at the edges. I've set up the css as follows: body { background: #000 url(gradient.jpg) repeat-x; margin: 0; } Here's where I run into my problem... I've created an empty DIV to hold the large image which will appear on top of the gradient and positioned it absolutely. <div id="bg_image"></div> #bg_image { width: 100%; height: 1100px; background: url(images/bg_image.jpg) no-repeat top center; margin: 0; position:absolute; } This works and the background looks like it should, however because the large image is inside a DIV, any time the browser window is smaller than that div (which will be the case for most users considering the image size) there will be scrollbars. This makes perfect sense of course I just can't come up with an alternative. If there was a way to extend a background image beyond the borders of a DIV that would work but overflow:visible; doesn't seem to work with background images only content. I wish I could set a repeating background AND a static background in the body style, because that is exactly the effect I'm trying to achieve. Any suggestions would be greatly appreciated! Thanks, Josh The layout I have going is a bit difficult to explain. Here's a diagram.. The area of importance is the header. The content and main head area are centered. The area to the left and right of the header are a <div>. However, as you can see, the background image on the left is different than the one on the right. I'm having difficulty making this work. the images can be stretched horizontally without a problem, but the two sides must meet in the middle beneath the header. I hope this makes sense. What I've got to do, I think, is tell the background image of the underlying <div> to stretch to 100%, and make this image 300px wide or so including both sides of the image and a split. The split would hide behind the header. I can't find a method to stretch the background image, though. Does anybody know of a better way, or a way to achieve this method at all without getting into completely different layouts? Thanks in advance for any assistance/suggestions. In the following code...why is there a space between the two div's?? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <style> #header { background-color: cadetblue; } #footer { background: blue; } </style> </head> <body> <div id="header"> <p>This is my header.</p> </div> <div id="footer"> <p>This is my footer.</p> </div> </body> </html> If I remove the <p></p>'s from each sentence the spacing disappears. If I add a "border: 1px solid black;" to each style the spacing disappears. I don't want to know how to make it go away. I want to know why it's there? I mean shouldn't the paragraphs be fully enclosed inside the div's? Such that no spacing should appear between the div's? Any insight anyone might care to share with me would be most appreciated. Thanks. Carlos I've been trying to get all the space out of IE, tried line-height and all of that, and nothing. Any hack to take out all of the space gaps so I can later on put some small margin? Thanks in advance I have layed out the page but cannot seem to get the hang of the floats and positioning....!! If anyone can give me a hint how I can position my text in the main white space I would be so grateful as I am confusing myself as to what i am doing wrong!! the site is hosted at www dot getatrader dot com PLEASE HELP!! here is the CSS: Code: body { background: white; font-size: smaller; font-weight: bold; font-family: Verdana,Arial,Helvetica,sans-serif; } #topnav { float:left; position: absolute; } #topnav img{ display: block; border: none; } #header{ position: relative; text-align: right; border: solid thin #999999; margin: 0px 0px 0px 0px; background: #336699; font-family: Verdana,Arial,Helvetica,sans-serif; color: #ffffff; height: 155px; } #headerright{ position: relative; top: 20px; right: 10px; } #headerright li { display: inline; list-style: none; padding: 40px; } #headerright img { border: none; } #headerright a:link { color: #ffffff; text-decoration: none; } #headerright a:visited { color: #ffffff; text-decoration: none; } #headerright a:hover { color: #ffffff; text-decoration: none; } #headerright a:active { color: #ffffff; text-decoration: none; } h1 { } h2 { width: 200px; text-align: center; color: white; background-color: black; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: large; font-weight: bold; } #container { width: 956px; padding: 10px; margin: 0px auto 0px auto; height: auto; text-align: left; border: 1px solid #ddd; } #button { position: relative; display: block; width: 152px; border-right: 1px solid #000; padding: 0 0 1em 0; margin-bottom: 1em; font-family: Verdana,Arial,Helvetica,sans-serif; background-color: #336699; color: #333; } #button ul { list-style: none; margin: 0; padding: 0; border: none; height: 500px; } #button li { border-bottom: 1px solid #90bade; margin: 0; } #button li a { display: block; padding: 5px 5px 5px 0.5em; border-left: 10px solid #1958b7; border-right: 10px solid #508fc4; background-color: #2175bc; color: #fff; text-decoration: none; width: 100%; } html>body #button li a { width: auto; } #button li a:hover { border-left: 10px solid #1c64d1; border-right: 10px solid #5ba3e0; background-color: #2586d7; color: #fff; } #maintext { position: absolute; float: left; } #footer { color: white; background-color:#336699; font-size: small; font-family: Verdana,Arial,Helvetica,sans-serif; margin: 0px 0px 0px 0px; } Hi everyone. I have a header image and directly below it the div that holds my navigation. In FF it works great, but in IE I get about a 5px space inbetween the header image and the navigation div. The navigation div is colored so it's really easy to tell where it stops and starts in IE. Here's my CSS code: Code: body { background-image: url(images/bgshadow.gif); background-repeat: repeat-y; background-position: 50% 0; text-align: center; margin: 0 0; padding: 0 0; } #content { width: 738px; margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; padding: 0 0; vertical-align: top; } #header { width: 738px; margin: 0 0; padding: 0 0; } #nav { width: 738px; height: 25px; margin: 0 0; padding: 0 0; background-color: #86462F; vertical-align: top; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; color: #fff; } #nav ul { width: auto; float: right; margin: 5px 0 0 0; padding: 0 0; } #nav ul li { margin: 0 25px 0 0; padding: 0 0; list-style-type: none; display: inline; } and my markup: Code: <div id="content"> <div id="header"> <img src="images/header.jpg" width="738" height="100" /></div> <div id="nav"> <ul> <li>Home</li> <li>Register</li> <li>Go Play!</li> </ul> </div> I've tested the white-space bug in windows IE (taking out all of the white-space in the markup) but that only had a marginal effect on the list. Does anyone have any ideas? Thanks, -Brian |