OVERTONE OVERTONE - 1 year ago 90
CSS Question

remove space above and below <p> tag HTML

So simple enough.

Take this ul for example.

<li>HI THERE</li>
<p >ME </p>

When the innerHtml of an Li tag is blank, the Li wraps itself right up to the text.

It doesn't happen for the P tag. I'm assuming this is because p is for paragraphs which usually have white space breaks before and after.

My question:

Is there any way to remove this?

Answer Source

<p> elements generally have margins and / or padding. You can set those to zero in a stylesheet.

li p {
    margin: 0;
    padding: 0;

Semantically speaking, however, it is fairly unusual to have a list of paragraphs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download