Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Why is there a margin between div's even though margin is set to zero?
Old 05-21-2009, 03:31 PM Why is there a margin between div's even though margin is set to zero?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
I am trying to do a liquid design.

So I started out to put all divs on top of each other before I would decide where to float what.

The weird thing. Between the first three divs there is a space of about 20px.

Even if I define margin to be 0px in the CSS, the gap doesn't go away.
World is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-21-2009, 03:41 PM Re: Why is there a margin between div's even though margin is set to zero?
4layouts's Avatar
Skilled Talker

Posts: 66
Name: Mike McKeown
Location: St. Louis, MO
Trades: 0
Would you be able to post your CSS? If I could take a look at it I might be able to help you out.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
4layouts is offline
Reply With Quote
View Public Profile Visit 4layouts's homepage!
 
Old 05-21-2009, 04:28 PM Re: Why is there a margin between div's even though margin is set to zero?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
There isn't a problem with my CSS. It passed the CSS validation without an error.

I think this is just what's called blockspace.

There's a design pattern that's called blockspace removal. Going to try this one out.

It's just weird that I have one example of divs joining without a blockspace.
World is offline
Reply With Quote
View Public Profile
 
Old 05-21-2009, 05:16 PM Re: Why is there a margin between div's even though margin is set to zero?
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
You can pass the CSS validator with flying colors, and still have something that will give you unexpected results. If you can post your HTML and CSS, it would help us to help you find the problem. It's hard to just guess. It could be margin or padding on other elements, it could be the way you have thing laid out, or a number of other things that wouldn't cause a validation error, but could give you unexpected results.
__________________

Please login or register to view this content. Registration is FREE
angele803 is offline
Reply With Quote
View Public Profile
 
Old 05-21-2009, 06:15 PM Re: Why is there a margin between div's even though margin is set to zero?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
It passed the CSS validation without an error.
Doesn't mean there isn't something wrong with the way it's coded

Sounds to me like margin-collapse at work, and that's not a bug. Try adding padding-top: 1px to one or more of the divs and see if the gap goes away. It happens when you stack divs like that.

Gotta see the code to know for certain.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-22-2009, 08:56 PM Re: Why is there a margin between div's even though margin is set to zero?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
It's gone.

First I made it go away by adding a negative margin.

Then I reworked the whole design and could finally throw away the negative margin.

I definitely messed something up at the beginning, but I can't tell any more what it was.
World is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Why is there a margin between div's even though margin is set to zero?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45877 seconds with 12 queries