White8Tiger
White8Tiger

Reputation: 294

Can't use certain Width - CSS menu

I got this menu and I need all items to be the same width (155px). But I don't seem to be doing it the right way, I would appreciate some tips and possible solutions.

#menu {
  width: 1000px;
  height: 625px;
  text-transform: uppercase;
  text-align: left;
  font-size: 10px;
  margin: 0 auto;
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
}
#menu span {
  padding-left: 11px;
}
#menu ul {
  margin: 0;
  padding: 25px 0 0 0;
}
#menu li {
  background: url(../img/menu_dots.jpg) no-repeat;
  display: inline;
  padding-bottom: 614px;
  padding-top: 25px;
  width: 155px;
}
#menu li a {
  text-decoration: none;
  color: #D1D3D4;
}
#menu li a:hover {
  color: #000;
  font-weight: 700;
}
#menu li .current {
  color: #000;
  font-weight: 700;
}
<div id="menu">
  <ul>
    <li><a href="index.html" class="current"><span>OCTO</span></a>
    </li>
    <li><a href="equipa.html"><span>EQUIPA</span></a>
    </li>
    <li><a href="reconhecimento.html"><span>RECONHECIMENTO</span></a>
    </li>
    <li><a href="parceiros.html"><span>PARCEIROS</span></a>
    </li>
    <li><a href="porque_nao.html"><span>PORQUE NÃO?</span></a>
    </li>
    <li><a href="contactos.html"><span>CONTACTOS</span></a>
    </li>
  </ul>
</div>

Upvotes: 0

Views: 26

Answers (3)

Roma Barantsevich
Roma Barantsevich

Reputation: 27

Yes, it is a good solution but after adding display:inline-block; to li actual width wil be 166px, because of padding-left:11px also mind it;

Upvotes: 1

Anas EL KORCHI
Anas EL KORCHI

Reputation: 2048

you need to add into the menu li the properties overflow:hidden and max-width:155px and min-width:155px

Upvotes: 0

j08691
j08691

Reputation: 207901

Easiest solution would be to change the display on the list items (#menu li) from inline to inline-block.

#menu {
  width: 1000px;
  height: 625px;
  text-transform: uppercase;
  text-align: left;
  font-size: 10px;
  margin: 0 auto;
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
}
#menu span {
  padding-left: 11px;
}
#menu ul {
  margin: 0;
  padding: 25px 0 0 0;
}
#menu li {
  background: url(../img/menu_dots.jpg) no-repeat;
  display: inline-block;
  padding-bottom: 614px;
  padding-top: 25px;
  width: 155px;
}
#menu li a {
  text-decoration: none;
  color: #D1D3D4;
}
#menu li a:hover {
  color: #000;
  font-weight: 700;
}
#menu li .current {
  color: #000;
  font-weight: 700;
}
<div id="menu">
  <ul>
    <li><a href="index.html" class="current"><span>OCTO</span></a>
    </li>
    <li><a href="equipa.html"><span>EQUIPA</span></a>
    </li>
    <li><a href="reconhecimento.html"><span>RECONHECIMENTO</span></a>
    </li>
    <li><a href="parceiros.html"><span>PARCEIROS</span></a>
    </li>
    <li><a href="porque_nao.html"><span>PORQUE NÃO?</span></a>
    </li>
    <li><a href="contactos.html"><span>CONTACTOS</span></a>
    </li>
  </ul>
</div>

Upvotes: 2

Related Questions