I have NavBar Links on the top right of my website and they have a white fill when active and when hovering over them but the white fill is only surrounding the words and I want to know how to adjust how large the white space is.
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0px;
}
.header {
padding: 10px;
background-color: black;
display: flex;
justify-content: space-between;
align-items: center;
}
.header h1 {
color: white;
text-decoration: none;
overflow: hidden;
}
.topnav {
overflow: hidden;
}
.topnav a {
color: #f2f2f2;
text-align: center;
padding: 14px 15px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: white;
color: black;
border: 10px;
}
.topnav a.active {
background-color: white;
color: black;
width: 100px;
}
<div class="header">
<h1>Redacted</h1>
<div class="topnav">
<a class="active" href="index.html">Home</a>
<a href="resume.html">Resume</a>
<a href="contact.html">Contact</a>
</div>
</div>
I want the buttons to have a large fill instead of mainly just around the text.
3
Answers
You can modify the padding of the
<a>
elements within your.topnav
.You can apply
padding-left
andpadding-right
to the active and hovered elements:You can add the below Style code to your CSS File.
Hope, It will be works for you.