Reputation: 157
i want to add border right for each navigation menu .. the problem i happent is i don't want 100% border . need a gap top and border. and i need click functionaly for complete div. i try like this way
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
border-right: 1px red solid;
}
li a:hover {
background-color: #111;
}
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
i don't want that red border with 100% height. just need a gap top and botoom...
Upvotes: 1
Views: 55
Reputation: 4251
Try this. Use pseudo-element :after
for this.
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
position:relative;
}
li a::after {
content: "";
background: red;
height: 22px;
width: 1px;
right: 0;
top: 0;
bottom: 0;
margin: auto;
position: absolute;
}
li a:hover {
background-color: #111;
}
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
Upvotes: 4