View Full Version : divs - no space between?
07-09-2008, 02:47 AM
I want to do 2 sections as separate divs one on top of the other, but I don't want any space between them. Can this be accomplished or will I have to make them in the same div?
07-09-2008, 04:03 AM
Yes, it can.
07-09-2008, 04:05 AM
ok... how? :) Whenever I create new divs it puts a space between them.
07-09-2008, 04:08 AM
Have you tried adding:
to the top of your CSS?
07-09-2008, 04:19 AM
or better yet
07-09-2008, 04:22 AM
That doesn't seem to do anything :(
Here's what I'm trying to create:
I was thinking that I should use 2 divs: 1 for the top box and then 1 right under it for the "notes" box. Ideas?
07-09-2008, 03:57 PM
well give us the look to what its doing, and some code.
07-09-2008, 05:08 PM
div is an empty element. It, like span, has no semantic meaning whatsoever — and the only difference between div and span is that div is a block level element while span is an inline one. Because they are completely empty elements they aren't given any dimension, margin, or padding by the browser until you set it:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<title>divs are empty elements</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
border: solid 1px #000; }
…see? If you're getting spaces in between divs it means something inside the divs are pushing them apart, or you've applied styles to your divs and you need to alter them.
As far as how to make your little picture a webpage, start like you would any other (well-built) HTML-based website in the universe — mark up the HTML as semantically as you can, use extra markup as "hooks" if necessary, and then style with CSS. Without any HTML to style, CSS is useless.
07-09-2008, 06:30 PM
And this is good to know, too: http://complexspiral.com/publications/uncollapsing-margins/
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.