Struggling to incorporate tab code into a page with conflicting CSS? Even after attempts to edit classes and labels, the original code fights back against the new additions. While scoped CSS seems like the perfect fix, it's not widely supported yet.
What other solutions can be explored?
Check out this JS Fiddle for reference: https://jsfiddle.net/dcLjve28/1/ Feel free to visit the page where I intend to implement the tabs for better box organization:
I won't include the extensive CSS already present on the page unless requested, but here's the code I'm looking to add:
<div class="tabs">
<!-- Radio button and label for #tab-content1 -->
<input type="radio" name="tabs" id="tab1" checked >
<label for="tab1">
<i class="fa fa-rocket" aria-hidden="true"></i>
<span>Projects</span>
</label>
<!-- Radio button and label for #tab-content2 -->
<input type="radio" name="tabs" id="tab2">
<label for="tab2">
<i class="fa fa-users" aria-hidden="true"></i><span>Flash-Mobs</span>
</label>
<!-- Radio button and label for #tab-content3 -->
<input type="radio" name="tabs" id="tab3">
<label for="tab3">
<i class="fa fa-heartbeat" aria-hidden="true"></i><span>Movement</span>
</label>
<div id="tab-content1" class="tab-content">
<h3>Positive Action Projects</h3>
<p><!-- Tab content here --></p>
</div> <!-- #tab-content1 -->
<div id="tab-content2" class="tab-content">
<h3>International Positive Action Days</h3>
<p><!-- Tab content here --></p>
</div> <!-- #tab-content2 -->
<div id="tab-content3" class="tab-content">
<h3>Grow the Movement</h3>
<p><!-- Tab content here --></p>
</div> <!-- #tab-content3 -->
CSS
.tabs {
max-width: 90%;
float: none;
list-style: none;
padding: 0;
margin: 75px auto;
border-bottom: 4px solid #ccc;
}
.tabs:after {
content: '';
display: table;
clear: both;
}
.tabs input[type=radio] {
display:none;
}
/* Additional CSS styling provided */
@media (min-width: 768px) {
.tabs i {
padding: 5px;
margin-right: 10px;
}
.tabs label span {
display: inline-block;
}
.tabs {
max-width: 750px;
margin: 50px auto;
}
}
Sincerely, Andy