I am looking to create tab contents using CSS. I have managed to create a custom tab style, but I am struggling to style its content with CSS. Can anyone provide guidance on how I can achieve this?
CSS:
.tabs {
list-style: none;
margin: 0;
padding: 0;
position: relative;
}
.tabs li {
margin: 0 2px;
padding: 10px;
cursor: pointer;
background: white;
display: inline-block;
}
.tabs li:not(.active):hover
{
background: #ccc;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
}
.tabs li > a
{
text-decoration: none;
color: gray
}
.tabs li.active
{
z-index: 1000;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border: 1px solid #ccc;
border-bottom-color: #fff;
color: grey;
cursor: default;
}
.tabs:after
{
position: absolute;
content: "";
width: 100%;
z-index: 1;
bottom: 0;
left:0;
border-bottom: 1px solid #ddd;
}
.tabs:before
{
z-index: 1;
}
HTML:
<ul class="tabs">
<li class="active"><a href="#tab1">Home</a></li>
<li><a href="#tab2">Contact</a></li>
<li><a href="#tab3">Services</a></li>
</ul>