移除上方和下方的空间< p>标记HTML [英] remove space above and below <p> tag HTML

查看:151
本文介绍了移除上方和下方的空间< p>标记HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这么简单。



以此ul为例。

 < ul& 
< li> HI THERE< / li>
< br>
< li>
< p> ME< / p>
< / li>
< / ul>

当Li标签的innerHtml为空时,Li自动换行。 / p>

这不会发生在P标签。我假设这是因为p是用于通常在之前和之后有空白符号的段落。



我的问题:


$ b $

c $ c>元素通常具有边距和/或填充。您可以在样式表中将它们设置为零。

  li p {
margin:0;
padding:0;
}

然而,从语义上讲,


So simple enough.

Take this ul for example.

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

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?

解决方案

<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.

这篇关于移除上方和下方的空间&lt; p&gt;标记HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆