Amount of space after <p> paragraph tag.

R

RetroMIDI

I notice that the <p> tag does not always allow the same amount of
space. Some websites have about half a line only. When I check their
code, they have used just <p>. On other occasions it seems that <p>
has left not just one line of space as per the current font size, but
as much as 20 or 30 pixels.

Can someone please explain to me how to control what <p> does in terms
of space after a paragraph using a CSS.
 
D

dorayme

<[email protected]
m>,
RetroMIDI said:
I notice that the <p> tag does not always allow the same amount of
space. Some websites have about half a line only. When I check their
code, they have used just <p>. On other occasions it seems that <p>
has left not just one line of space as per the current font size, but
as much as 20 or 30 pixels.

Can someone please explain to me how to control what <p> does in terms
of space after a paragraph using a CSS.

You can control this by setting your own margin and padding on
paragraphs instead of letting the individual browsers set their
own styles. Need an example?
 
A

asdf

RetroMIDI said:
I notice that the <p> tag does not always allow the same amount of
space. Some websites have about half a line only. When I check their
code, they have used just <p>. On other occasions it seems that <p>
has left not just one line of space as per the current font size, but
as much as 20 or 30 pixels.

Can someone please explain to me how to control what <p> does in terms
of space after a paragraph using a CSS.

Here's my 'standard' p redefinition that you can play with/modify to suit:

p {
padding: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 1em;
margin-left: 0;
}

What does it do? It stops all padding and margins for all p tags, and adds a
1em margin to the bottom.

It's important that you do not use pixel spacings for (at least) textual
elements. If the viewer changes their viewable font size, it is desirable
that any white space also changes to suit.
 
A

Andy Dingley

I notice that the <p> tag does not always allow the same amount of
space.

It has however much space you specify in CSS, together with the notes
on how these CSS rules should be interpreted.

One aspect that hasn't been mentioned here is "collapsing vertical
margins".

Read all about it here:
http://brainjar.com/css/positioning/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top