如何减小HTML中项目符号列表之间的行距?

问题描述 投票:0回答:1

我有一个项目符号列表,我需要从[在此处输入图像描述] [1]中删除间距。这是代码:

<li style="font-weight: 400;"><span style="font-weight: 400;">Registrations&nbsp;</span>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Business name</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">....</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Trade marks/designs/patents</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Vehicle registration</span></li>
</ul>
</li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Membership fees</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Accountant fees</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">.....</li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Insurance&nbsp;</span>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Building and contents</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">...</li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Business assets</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Business revenue</span></li>
</ul>
</li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Printing</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Stationery and office supplies</span></li>```

I understand its the fixed issue with the <ul> being read as a space but I've tried variations of ul style, margins and line heights from other stack overflow questions but I'm having no joy as I'm not entirely sure where to put the code in to the list. Could someone tell me where exactly to insert the necessary code to change it please? Apologies for my very limited coding knowledge here. Exact help would be greatly appreciated though!


  [1]: https://i.stack.imgur.com/TKZEP.png
html html-lists
1个回答
0
投票

您正在寻找CSS解决方案。这将满足您的需求。将其添加到您的CSS。

ul, li {
margin: 0;
padding: 0;
}
© www.soinside.com 2019 - 2024. All rights reserved.