gpt4 book ai didi

html - 将之后的元素内联到 block 元素

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

这是简单的html

<p> some text here </p>
<a href="#">more</a>

还有我试过的css

p+a{
color: #f00;
display: inline-block;
/* also tried float: left; */
}

将输出调成这样

some text here more

我想要 p 行中的更多

最佳答案

p 是 block 级元素。所以你不能内联到a。因此,您需要将 p 的样式设置为 display: inline;display: inline-block; 然后给 display: inline; display: inline-block;a

这里是 fiddle .

关于html - 将之后的元素内联到 block 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17184598/

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