gpt4 book ai didi

html - Accordion 按钮内的奇怪文本间距

转载 作者:太空宇宙 更新时间:2023-11-04 06:03:26 25 4
gpt4 key购买 nike

我正在为 Accordion 按钮中的一些奇怪间距而苦苦挣扎。有没有办法让它更统一?

我尝试删除所有   标签并尝试添加边距。

<button class="accordion">What can I expect at my hotel?</button>

<div class="panel">
<p>&nbsp;</p>

<p><span style="font-size:16px"><span style="font-family:arial,helvetica,sans-serif">All rooms will have a hairdryer, an iron, a small safe and tea and coffee making facilities. Basic Wi-Fi is included.</span></span></p>

<p><span style="font-size:16px"><span style="font-family:arial,helvetica,sans-serif">Check-in is from 4pm and check-out by 12pm.</span></span></p>
</div>

结果应该是两段文字,顶部和底部的边距统一,但我实际得到的是顶部的大空间和底部的小空间

最佳答案

默认情况下,CSS 会为您的元素添加一些默认边距和填充,您应该始终从通用重置开始,就像我在 CSS 代码中所做的那样,以消除这种不需要的行为。然后您可以根据需要定义自己的边距和填充。

*,*:before,*:after {
margin:0;
padding:0;
}
<button class="accordion">What can I expect at my hotel?</button>

<div class="panel">
<p>&nbsp;</p>

<p><span style="font-size:16px"><span style="font-family:arial,helvetica,sans-serif">All rooms will have a hairdryer, an iron, a small safe and tea and coffee making facilities. Basic Wi-Fi is included.</span></span></p>

<p><span style="font-size:16px"><span style="font-family:arial,helvetica,sans-serif">Check-in is from 4pm and check-out by 12pm.</span></span></p>
</div>

关于html - Accordion 按钮内的奇怪文本间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57091710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com