[英]How to remove space between paragraph and specific html list
How do I remove space between paragrah and a specific html list?如何删除段落和特定 html 列表之间的空格? Based on image provided, I want the list to be moved up closer to the paragrah:
根据提供的图像,我希望将列表移到更靠近段落的位置:
<p><strong>Reason</strong><br/>
As part of the change from the NHS, the following drugs are unable to be prescribed by the doctor and requires a special consultant to prescribe these medications:
<ul class="nospaceabovelist">
<li>Clonazepam</li>
<li>Imitrex</li>
<li>Amoxil</li>
<li>Sensipar</li>
</ul>
</p>
p + .nospaceabovelist li{
margin: 0;
padding:0;
}
Paragraphs cannot contain ul
so you need to change the HTML.段落不能包含
ul
因此您需要更改 HTML。
Then just remove margins from both.然后只需从两者中删除边距。
p, p + .nospaceabovelist { margin: 0; padding: 0; }
<p><strong>Reason</strong><br/> As part of the change from the NHS, the following drugs are unable to be prescribed by the doctor and requires a special consultant to prescribe these medications:</p> <ul class="nospaceabovelist"> <li>Clonazepam</li> <li>Imitrex</li> <li>Amoxil</li> <li>Sensipar</li> </ul>
i think you search this :)我想你搜索这个:)
<html>
<head>
<style>
p
{
margin: 0;
padding:0;
line-height: .75em;
}
ul
{
margin: 0;
}
</style>
</head>
<body>
<p><strong>Reason</strong><br/>
As part of the change from the NHS, the following drugs are unable to be prescribed by the doctor and requires a special consultant to prescribe these medications:
<ul>
<li>Clonazepam</li>
<li>Imitrex</li>
<li>Amoxil</li>
<li>Sensipar</li>
</ul>
</p>
</body>
</html>
Add this in css:在 css 中添加:
p {
margin: 0;
}
ul {
margin: 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.