投票 我希望矩形宽度更小
请检查下面的链接来检查 HTML 和 CSS 中的代码并检查结果。拜托,我需要结果中的矩形宽度更小。
https://jsfiddle.net/Ahmed_abdelmeguid/6L8vbutw/5/ [在此处输入图像描述][1]
这是 CSS 代码
.tictac_3 > ul {
width: 50%;
height: 20px;
display: flex;
flex-wrap: wrap;}
.tictac_3 > li {
width: 30%;
height: 30px;
font-size: 30px;
font-family: sans-serif;
background-color:lightblue;
margin: 5px;
list-style: none;
text-align: center;
float: left;
}
,在 HTML 代码下方,
<ul class="tictac_3">
<li class=".tictac_3">X
<li class=".tictac_3">
<li class=".tictac_3">O
<li class=".tictac_3">
<li class=".tictac_3">X
<li class=".tictac_3">O
<li class=".tictac_3">X
<li class=".tictac_3">O
<li class=".tictac_3">
</ul>
您可以在我在问题开头提供的以下链接中检查代码和我想要修改它的结果 https://jsfiddle.net/Ahmed_abdelmeguid/6L8vbutw/5/
Please check the below link to check the code in HTML and CSS and check the result. Please, I need the rectangular in the result to be less wide.
https://jsfiddle.net/Ahmed_abdelmeguid/6L8vbutw/5/
[enter image description here][1]
this is CSS code
.tictac_3 > ul {
width: 50%;
height: 20px;
display: flex;
flex-wrap: wrap;}
.tictac_3 > li {
width: 30%;
height: 30px;
font-size: 30px;
font-family: sans-serif;
background-color:lightblue;
margin: 5px;
list-style: none;
text-align: center;
float: left;
}
and below the HTML code
<ul class="tictac_3">
<li class=".tictac_3">X
<li class=".tictac_3">
<li class=".tictac_3">O
<li class=".tictac_3">
<li class=".tictac_3">X
<li class=".tictac_3">O
<li class=".tictac_3">X
<li class=".tictac_3">O
<li class=".tictac_3">
</ul>
you can check the code and the result that I want to modify it in the below link That I provided it in the start of my question
https://jsfiddle.net/Ahmed_abdelmeguid/6L8vbutw/5/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题
好的,OP 代码在基本层面上存在一些问题:
每个
结束标记
丢失
选择器:
.tictac_3 > ul
不存在height: 20px
被分配给前面提到的选择器。如果它按照预期引用了,那么它就没有什么意义,因为它的所有
都是
height: 30px
更改
上的单个类被删除足够了。
添加了
max-width: 12rem;
到每个
已更改
height
从绝对值30px
到相对值2rem
。更改
font-size
与更改height
完全一样。将
边距
从5px
减少到1px
添加了一点
padding-bottom:0.25em
Problems
OK, there are some problems with OP code that are at fundamental level:
Every
<li>
end tag</li>
is missingThe selector:
.tictac_3 > ul
does not existheight: 20px
is assigned to the previously mentioned selector. If it referenced the<ul>
as was intended, it would make very little sense since all of it's<li>
areheight: 30px
Changes
All of the classes on the
<li>
is removed, a single class on the<ul>
is sufficient.Added
max-width: 12rem;
to the<ul>
Each
<li>
Changed
height
from an absolute value30px
to a relative value2rem
.Changed
font-size
exactly asheight
was changed.Decreased the
margin
from5px
to1px
Added a little
padding-bottom: 0.25em