I have a quick question.
I'm making a feedback survey with smiley emoticons like you can see below. The fonts I'm using doesn't have a the circle of the face, so I'm just trying to draw it.
My problem is that the circle width is never set so the smileys always have different faces width:
My code:
.rating-item{
border-width:3px;
border-color:black;
font-size:150%;
font-style:bold;
}
.rating-item span{
border-width: 2px;
padding:5.5px;
width:30px;
border-style: solid;
border-radius: 50%;
}
<div class="article-survey-container ">
<div class="article-survey ">
<div class="selected-text"></div>
<div class="recorded-message"></div>
<ul class="ratings">
<li data-rating="5" class="rating-item" id="muy-dificil-rating"> <span class="fontelico-emo-unhappy "> </span></li>
<li data-rating="4" class="rating-item" id="dificil-rating"> <span class="fontelico-emo-displeased"> </span></li>
<li data-rating="3" class="rating-item"id="normal-rating"> <span class="fontelico-emo-sleep"> </span></li>
<li data-rating="2" class="rating-item"id="facil-rating"> <span class="fontelico-emo-happy"> </span></li>
<li data-rating="1" class="rating-item" id="muy-facil-rating"> <span class="fontelico-emo-grin"> </span></span></li>
</ul>
<br>
<input type="hidden" name="dificultad" id="dificultad" value="">
</div>
</div>
</div>
Any Css/Hml Idea?
You need to set your span
elements to display: inline-block
or display: block
, otherwise by default they'll be set to display: inline
, which will mean your width
declaration will be ignored.
.rating-item span {
...
display: inline-block;
}
span {
background: #f00;
color: #fff;
height: 30px;
line-height: 30px;
text-align: center;
width: 30px;
}
ul.inline-block span {
display: block;
}
ul.no-inline-block span {
display: inline;
}
ul {
list-style-type: none;
}
li {
display: inline-block;
}
<h2>With block or inline block</h2>
<ul class="inline-block">
<li>
<span>1</span>
</li>
<li>
<span>2</span>
</li>
<li>
<span>3</span>
</li>
</ul>
<h2>Without block or inline block</h2>
<ul class="no-inline-block">
<li>
<span>1</span>
</li>
<li>
<span>2</span>
</li>
<li>
<span>3</span>
</li>
</ul>
Try like this: Demo
.rating-item {
border-width:3px;
border-color:black;
font-size:150%;
font-style:bold;
}
.rating-item span {
border-width: 2px;
padding:5.5px;
width:30px;
height:30px;
border-style: solid;
border-radius: 50%;
display:block;
float:left;
margin:10px;
}
li{
list-style-type:none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With