PDA

View Full Version : <div> or something better for vertical spacing?


bryndyment
03-30-2003, 07:56 PM
If I want some vertical space between two thingies, should I be using:

<div style="height: 25;"></div>

... or is there a more CSS-kosher way? I know the above works, but is there a better official recommendation?

(Going through my old code, replacing all my "<p><p><br>" kinda stuff...)

pardicity3
03-30-2003, 08:05 PM
You can use margins!

http://www.w3c.org/TR/REC-CSS1#box-properties

liorean
03-30-2003, 08:06 PM
I think the best way to do that would be using margin-bottom, margin-top. In some cases padding might be the best solution,

Only in a few cases are empty elements acceptable as spacers - notably when working with realatively or absolutely positioned blocks containing floated blocks.

Cris79
03-31-2003, 01:12 PM
if you have <p> you can use this:

<html>
<head>
<style type="text/css">
p.first {margin-top: 1cm}
p.second {margin-top: 2cm}
</style>
</head>
<body>
<p class="first">
bla bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla
</p>
<p class="second">
bla bla bla bla bla bla bla bla bla bla <br>
bla bla bla bla bla bla bla bla bla bla
</p>
</body>
</html>

more at http://www.w3schools.com/css/css_margin.asp

Mhtml
03-31-2003, 01:24 PM
Originally posted by Cris79
if you have <p> you can use this:

<html>
<head>
<style type="text/css">
p.first {margin-top: 1cm}
p.second {margin-top: 2cm}
</style>
</head>
<body>
<p class="first">
bla bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla
</p>
<p class="second">
bla bla bla bla bla bla bla bla bla bla <br>
bla bla bla bla bla bla bla bla bla bla
</p>
</body>
</html>

more at http://www.w3schools.com/css/css_margin.asp

Eh? That's what has been said, lol :)

Cris79
03-31-2003, 01:38 PM
Sorry, :( I have try to give an example.

Mhtml
03-31-2003, 01:49 PM
The example is fine, lol .. Don't worry :)