1
How do I keep these three items centered? Note that there is a space left on the right side.
CSS
div.menu {
background-color: #333;
overflow: auto;
white-space: nowrap;
}
div.menu a {
display: inline-block;
color: white;
text-align: center;
padding: 15px;
width: 30%;
min-width: 30%;
max-width: 30%;
font-size: 110%;
text-decoration: none;
}
div.menu a:hover {
background-color: #777;
}
HTML
<div class="menu">
<a href="#">Item 1</a>
<a href="#">Item 2</a>
<a href="#">Item 3</a>
</div>
Either I’m getting a little distracted or I can’t identify this space on the right side?
– BrTkCa
tries to split 100/number of links.
– samuel silva
Centralizing LI or DIV will be the same, because the display:block|inline-block|table and float:left|right properties affect the behavior of almost all elements, just change the CSS selectors in the answer: http://answall.com/a/169088/3635 that already solves ;)
– Guilherme Nascimento