by davidsojevic · 6y ago · 0 comments
Just a small CSS tip for your header and footer menus -- instead of using ::before/::after pseudo elements in your anchors themselves, if you place the menu items in a list you can use them there so the vertical pipe isn't part of the links. For example the following HTML:
<ul class="menu">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>
With the following CSS: .menu {
list-style: none;
padding: 0;
text-align: center;
}
.menu li {
display: inline;
}
.menu li:not(:last-child)::after {
color: #000;
content: ' | ';
}
Let's you add anything to the menus (anchor tag or plain text) and they will be separated by the vertical pipe without being part of the links themselves.