Jump to content

Recommended Posts

[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]
Link to comment
https://forums.phpfreaks.com/topic/10072-css-problem/
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/10072-css-problem/#findComment-37471
Share on other sites

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 y

Something like this

[code].arttop {
background:url(images/index_08.jpg) repeat-x #186b9f;
height:70px;
margin:0;
padding:0;
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/10072-css-problem/#findComment-38813
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.