gpt4 book ai didi

html - float 列表问题

转载 作者:行者123 更新时间:2023-11-28 05:07:27 26 4
gpt4 key购买 nike

我正在创建一个 5 星评级的列表。我想从列表标题中添加星星,但我的星星没有显示在列表标题前。

.cont {
color: #eee;
margin: 0 auto;
max-width: 350px;
overflow: hidden;
padding: 0;
text-align: center;
width: 100%;
}
hr {
margin: 20px;
border: none;
border-bottom: thin solid rgba(255, 255, 255, .1);
}
div.stars {
width: 270px;
display: inline-block;
float: left;
}
input.star {
display: none;
}
label.star {
color: #444;
float: right;
font-size: 25px;
padding: 5px;
transition: all .2s;
}
input.star:checked ~ label.star:before {
content: '\f005';
color: #FD4;
transition: all .25s;
}
input.star-5:checked ~ label.star:before {
color: #FE7;
text-shadow: 0 0 20px #952;
}
input.star-1:checked ~ label.star:before {
color: #F62;
}
label.star:hover {
transform: rotate(-15deg) scale(1.3);
}
label.star:before {
content: '\f006';
font-family: FontAwesome;
}
/* LIST #3 */

#list3 {
float: left;
}
#list3 ul {
list-style-image: url("../images/arrow.png");
color: #4B4B4B;
font-size: 18px;
margin-left: 25px;
}
#list3 ul li {
line-height: 30px;
}
<div id="list3">
<ul>
<li>Estimated time: 43min</li>
<li>Distance in miles: 14 miles</li>
<li>Review Rating:
<div class="cont">
<div class="stars">
<form action="">
<input class="star star-5" id="star-5-2" type="radio" name="star" />
<label class="star star-5" for="star-5-2"></label>
<input class="star star-4" id="star-4-2" type="radio" name="star" />
<label class="star star-4" for="star-4-2"></label>
<input class="star star-3" id="star-3-2" type="radio" name="star" />
<label class="star star-3" for="star-3-2"></label>
<input class="star star-2" id="star-2-2" type="radio" name="star" />
<label class="star star-2" for="star-2-2"></label>
<input class="star star-1" id="star-1-2" type="radio" name="star" />
<label class="star star-1" for="star-1-2"></label>
</form>
</div>
</div>
</li>
</ul>
</div>

最佳答案

试试这个:http://codepen.io/g1un/pen/KgvrwZ

.cont {
color: #eee;
margin: 0 auto;
max-width: 350px;
overflow: hidden;
padding: 0;
text-align: center;
/* width: 100%; */

display: inline-block;
vertical-align: top;
}

div.stars {
/* width: 270px; */
display: inline-block;
/* float: left; */
}

导致标题下方出现评级图标的主要错误是评级 block 具有 display: block; 属性默认为 div 而您没有更改它。
width: 100% 中也不需要导致元素跳到另一行以适应此属性。

关于html - float 列表问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39769765/

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