body {
margin: 0;
}
.header {
width: 80%;
height: 20%;
margin-left: 10%;
position: fixed;
top: 0;
box-sizing: border-box;
border-style: solid;
border-width: 1px;
background-color: green;
}
.image {
width: 20%;
height: 100%;
float: left;
box-sizing: border-box;
border-style: solid;
border-width: 1px;
}
.navigation {
width: 79%;
height: 100%;
float: right;
text-align: right;
box-sizing: border-box;
border-style: solid;
border-width: 1px;
}
ul {
height: 100%;
font-size: 0;
box-sizing: border-box;
border-style: solid;
border-width: 1px;
background-color: yellow;
}
li {
height: 100%;
font-size: initial;
display: inline-block;
box-sizing: border-box;
border-style: solid;
border-width: 1px;
background-color: blue;
}
<div class="header">
<div class="image">
Image
</div>
<nav class="navigation">
<ul>
<li> 1.0 Main Menu </li>
<li> 2.0 Main Menu </li>
<li> 3.0 Main Menu </li>
</ul>
</nav>
</div>
With the above code I have created a <header>
containing of an <image>
and a <navigation>
. All this works fine so far.
Now I want that the text inside the <li>
element appears in the center. Therefore, I tried to go with the property text-align: center;
in the li CSS
but it did not work.
What do I have to change in my code to get the text within the <li>
elements centered?
You can also find my code here: https://jsfiddle.net/5jv8m5xf/39/
" element?
– arifCee Aug 20 '17 at 14:08