0

I would like to have three li elements with equal width. I used calc, however the code does not work.

width:calc(100%/3);
display:inline-block;

Snippet:

ul {
  position: fixed;
  bottom: 25px;
  left: 5%;
  width: 90%;
}

ul li {
  width: calc(100%/3);
  display: inline-block;
}

ul li:nth-child(2) {
  text-align: center;
}

ul li:nth-child(3) {
  text-align: right;
}
<ul>
  <li><a href="">Phone</a></li>
  <li><a href="">Imprint</a></li>
  <li><a href="">Email</a></li>
</ul>
dippas
  • 49,171
  • 15
  • 93
  • 105
didi
  • 247
  • 1
  • 5
  • 15

1 Answers1

1

Use display:flex in ul and flex: 1 in li

body {
  background: lightblue
}

ul {
  list-style: none;
  padding: 0;
  position: fixed;
  bottom: 25px;
  left: 5%;
  width: 90%;
  display: flex;
  background: white;
}

li {
  flex: 1;
  box-shadow: 0 0 0 1px black
}
<ul>
  <li><a href="">Phone</a></li>
  <li><a href="">Imprint</a></li>
  <li><a href="">Email</a></li>
</ul>
dippas
  • 49,171
  • 15
  • 93
  • 105