Create a circle over the span font icon

I have a quick question.

I am doing an emoji emoticon feedback poll as you can see below. The fonts I'm using don't have a face circle, so I'm just trying to draw one.

My problem is that the width of the circle is never set, so the emoji always have different edge widths:

enter image description here

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?

+3


source to share


3 answers


You need to set the elements span

to display: inline-block

or display: block

otherwise they will be set to by default display: inline

, which means your ad width

will be ignored.

.rating-item span {
    ...
    display: inline-block;
}

      




Demo

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>
      

Run codeHide result


+4


source


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;
}

      

+2


source


You need to do display: block and set width and height:

.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;
}

      

+1


source







All Articles