文本对齐:无序列表的中心在屏幕最小化时看起来关闭



在HTML中使用text-align:center时,当屏幕最小化时,以下<ul>元素看起来有点不对劲。看起来它偏向右。

如何使此列表更具响应性?

<div>
<p style="text-align:center;">
We're able to provide expertise across the entire IT and business spectrum, particularly in:
</p>
<br>
<ul style="text-align:center;list-style:none">
<li>Sportsbook and Data Services</li>
<li>Cloud Services Migration</li>
<li>Excel and VBA Enterprise Management</li>
<li>Financial Services</li>
<li>Mathematical Modelling</li>
</ul>
<br>
<p style=" text-align:center;">E-mail enquiries@sabg.co.uk to find out how we can help you lower your development costs and increase your output. <a href="mailto:info@sabg.co.uk"></a>
</p>
</div>

你应该对你的 ul 元素使用padding: 0;;

实际上我已经设法找到了答案, 无序列表不会居中对齐, 我认为这个 CSS 做到了:

ul{
position:relative;
display: inline-block;
list-style: none;
width:100%;
text-align: center;
margin: auto;
padding: 0;
}

最新更新