Voodum Posted May 20, 2006 Share Posted May 20, 2006 [a href=\"http://img174.imageshack.us/img174/6529/space4jd.jpg\" target=\"_blank\"]The problem[/a] Thats the link to a picture of the problem. I dont know why it does it, but it adds the spacing between the divs.Ive tried putting them on the same line, and making the margin and padding to 0, but I've had no luck so far.The CSS code is below, and then followed by the html code.[code].arttop {background:url(images/index_08.jpg) repeat-x;height:70px;margin:0;padding:0;}.mainbg {background:url(images/index_10.jpg) repeat-x #FFFFFF;border-left:#CCCCCC solid 1px;border-right:#CCCCCC solid 1px;margin:0;padding:0;}.bar {background:url(images/index_12.jpg) repeat-x;height:25px;margin:0;padding:0;}[/code]Now for the html[code]<div class="arttop">hi</div><div class="mainbg"> <p>hi</p> <p>h</p> <p>h</p> <p>h</p> <p>h</p> <p>h</p></div><div class="bar">hi</div>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10072-css-problem/ Share on other sites More sharing options...
moberemk Posted May 20, 2006 Share Posted May 20, 2006 At the start of all my CSS code, I tend to use this:[code]* { margin: 0px; padding: 0px; } [/code]This way, I'm the only one who specifies padding and borders.Is the background image shorter then the <div> itself? If it is, try making it smaller.If that doesn't work, try giving either element either a negative top or a negative bottom margin. Quote Link to comment https://forums.phpfreaks.com/topic/10072-css-problem/#findComment-37471 Share on other sites More sharing options...
Voodum Posted May 21, 2006 Author Share Posted May 21, 2006 Negative margins worked a treat! Many thanks. [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/10072-css-problem/#findComment-37617 Share on other sites More sharing options...
wildteen88 Posted May 21, 2006 Share Posted May 21, 2006 rather than use negiyive margins reduce the height of your .arttop class by 2 or 3 pixels as I think you have set the height too high or something and so you get that 2 or 3 pixs white line. Quote Link to comment https://forums.phpfreaks.com/topic/10072-css-problem/#findComment-37660 Share on other sites More sharing options...
nogray Posted May 25, 2006 Share Posted May 25, 2006 If the height might change based on content, you can add a background color to cover up the gab.It's always a good idea to add a background color of the last pixel of you background image when you repeat-x or ySomething like this[code].arttop {background:url(images/index_08.jpg) repeat-x #186b9f;height:70px;margin:0;padding:0;}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10072-css-problem/#findComment-38813 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.