gpt4 book ai didi

css - 如何更正CSS?

转载 作者:太空宇宙 更新时间:2023-11-03 19:47:19 24 4
gpt4 key购买 nike

<style type="text/css" media="screen">
#new_dom {
height:200px;
width:600px;
}

#new_dom span {
width: 100px;
font-weight:bold;
}
</style>


<div id="new_dom">

<span>One one one one one one one one</span>
<input type="text" name="one" value="" />
<br />

<span>two two two two two two two two two</span>
<input type="text" name="two" value="" />
<br />

<span>three three three three three three</span>
<input type="text" name="three" value="" />
<br />

<span>four four four four four four four</span>
<input type="text" name="four" value="" />
<br />

<span>five five five five five five five</span>
<input type="text" name="five" value="" />

</div>

您好,为什么跨度的宽度不起作用?好像没有设置成100px

最佳答案

Span 是一个内联元素。如果没有成为 block 内联 block 元素,它不会接受width

要解决这个问题,您需要做类似的事情

#new_dom span {
width: 100px;
font-weight:bold;
display:inline-block;
}

关于css - 如何更正CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7876488/

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