html – 如何减少hr标签的默认边距?
发布时间:2020-12-14 22:30:25 所属栏目:资源 来源:网络整理
导读:我可以增加hr标签的默认边距.但我不能将hr的余量减少到零.我只需要水平线,顶部和底部边距为零 pThis is header/phr class="divider" /pThis is content. I just want to reduce the margin of hr tag/p hr.divider{ margin-top: 0em; margin-bottom: 0em; bo
我可以增加hr标签的默认边距.但我不能将hr的余量减少到零.我只需要水平线,顶部和底部边距为零
<p>This is header</p> <hr class="divider" /> <p>This is content. I just want to reduce the margin of hr tag</p> hr.divider { margin-top: 0em; margin-bottom: 0em; border-width: 2px; } 另见this jsfiddle. 解决方法
你已经成功了. hr没有上边距或下边距.它是显示填充和/或边距的p元素.在这里你可以看到这个:
hr.divider { margin: 0em; border-width: 2px; } p { margin: 0; padding: 0; } <p>This is header</p> <hr class="divider" /> <p>This is content. I just want to reduce the margin of hr tag to zero</p> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |