I am trying to center an h1 element in my navigation, alongside two other elements, without using an image. I want it to be responsive as well. I have attempted various methods but have had limited success, as most solutions require the use of background images. When trying to use inline-block, I struggle to center it perfectly.
Below is the best attempt I have made so far, but the hover effect does not work, likely due to the h1 width being set at 100%.
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: white;
text-shadow: 1px 1px 1px black;
}
li {
list-style: none;
}
header {
margin: 0 auto;
text-align: center;
}
ul li {
float: left;
display: block;
background-color: #232323;
width: 50%;
padding: 10px 0 10px 0;
}
ul li:hover {
background-color: black;
}
.logo {
position: relative;
top: -38px;
}
<header>
<nav>
<ul>
<li><a href='#blog'>Blog</a>
</li>
<li><a href='#portofolio'>Portofolio</a>
</li>
</ul>
</nav>
<a href='#/' class='logo'><h1>Tao SandBox</h1></a>
</header>
There must be a more efficient way to achieve this!