gpt4 book ai didi

html - 如何在 css 中内联显示标题和段落元素?

转载 作者:行者123 更新时间:2023-11-28 04:56:52 25 4
gpt4 key购买 nike

我有一个 HTML 代码,其中包含一个标题和 2 个段落元素:

<div class="inter">

<h4>Note</h4>

<p>To add/remove a dependent or to modify your spouse's insurer information, go to the My Life Events section and follow the instructions.</p>

<p>To modify your beneficiaries, please complete and sign the Beneficiary designation form and return it to your plan administrator.</p>

</div>

我希望上面的代码以下面的方式显示:enter image description here

我尝试使用 div.inter>p,h4 { display: inline;} 但是通过使用它我无法在 2 个段落之间创建换行符(如下所示)。

Note: To add/remove a dependent or to modify your spouse's insurer information, go to the My Life Events section and follow the instructions.To modify your beneficiaries, please complete and sign the Beneficiary designation form and return it to your plan administrator.

最佳答案

float 标题 <h4> .

* {
margin: 0;
padding: 0;
}
.inter > h4 {
float: left;
padding-right: .5em;
}
p {
margin-bottom: 1em;
}
<div class="inter">

<h4>Note</h4>

<p>To add/remove a dependent or to modify your spouse's insurer information, go to the My Life Events section and follow the instructions.</p>

<p>To modify your beneficiaries, please complete and sign the Beneficiary designation form and return it to your plan administrator.</p>

</div>

关于html - 如何在 css 中内联显示标题和段落元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40344956/

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