gpt4 book ai didi

HTML 和 CSS 文本换行,某些元素的样式与其他元素不同

转载 作者:太空宇宙 更新时间:2023-11-04 02:08:42 28 4
gpt4 key购买 nike

我想要一个固定宽度的容器,标签需要有不同的样式,但要包裹在容器内。有什么想法吗?

div {
width: 200px;
background-color: rgba(0,0,0,0.6);
margin: 10px;
padding: 10px;
}
p {
margin: 0px;
color: white;
font-family: sans-serif;
font-weight: 100;
}
p:nth-child(1) {
font-weight: 600;
}
<div>
<p>This Text in BOLD.</p>
<p>And we want this in normal weight but we want it to wrap as it is doing in the second example.</p>
</div>
<div>
<p>This Text in BOLD. And we want this in normal weight but we want it to wrap as it is doing in the second example.</p>
</div>

最佳答案

div {
width: 200px;
background-color: rgba(0,0,0,0.6);
margin: 10px;
padding: 10px;
}
p{
margin: 0px;
color: white;
font-family: sans-serif;
font-weight: 100;
}
span {
font-weight: 600;
}
<div>
<p><span>This Text in BOLD.</span> And we want this in normal weight but we want it to wrap as it is doing in the second example.</p>
</div>

关于HTML 和 CSS 文本换行,某些元素的样式与其他元素不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40173851/

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