0

I need to center the content of an li vertically so what i did is a lineheight and it works but the problem is that when I have multiple lines, this technique no longer works and i can't modify the html since it's a constraint given by the professor. So i really ran out of solutions.

Here is the HTML And the Css

    li
    {
    
        
     list-style-type:none; 
     border-bottom: 1px solid #e0e0e0;
     height: 55px;
     display: inline-block;
        vertical-align: middle;
        width: 100%;
        line-height: 55px;
    
    }
    ul
    {
     list-style : none;
      
    }
<ul>
     <li>
             The 2015–16 UEFA Champions League was the 61st season of Europe's premier club football tournament organised by UEFA, and the 24th season since it was renamed from the European Champion Clubs' Cup to the UEFA Champions League
          
       </li>
  
    </ul>
j08691
  • 204,283
  • 31
  • 260
  • 272
Brandon Jose
  • 11
  • 1
  • 4

1 Answers1

0

.parent {
  display: table;
  height:  260px;
  width:   180px;
  padding: 10px;
  border:  2px solid darkgray;
}
.parent li {
  border:1px solid blue;
  display:        flex;
  vertical-align: middle;
  padding:8px;
}
<ul class="parent">
  <li>Something about Footbal</li>
  <li>Something about Footbal</li>
  <li>Something about Footbal</li>
</ul>

The position of the child element is related to his parent's display property. If the parent will have display:table , the child will have display:table-cell and vertical-align:middle.

We have more examples here and also here

Andrei
  • 39
  • 8