I've made a jsfiddle of my rough setup here:
https://jsfiddle.net/9h5eqsuy/1/
a) My issue is I have tabs working fairly well, but it won't keep the active purple state once its clicked. I've tried a few solutions to no avail.
b) Additionally, I cant figure out how to have "item 1" tab open by default when you load the page.
I would like to avoid javascript if possible. Any thoughts would be great.
HTML
<p>
<div class="tabbuttonsdiv">
<a href="#item1" class="tabbuttons">item 1</a>
<a href="#item2" class="tabbuttons">item 2</a>
<a href="#item3" class="tabbuttons">item 3</a>
</div>
<div class="items">
<p id="item1" class="tabcontent">... item 1...
<p id="item2" class="tabcontent">... item 2...
<p id="item3" class="tabcontent">...
</div>
</p>
CSS
div.items p {
display: none;
}
div.items p:target {
display: block;
}
.tabbuttons{
color: #fff;
background-color:#3195c1;
border: none;
padding: 10px;
}
.tabbuttons:hover {
background-color:PURPLE;
}
.tabcontent{
background: #ddd;
min-height: 100px;
}
A final question if anyone is feeling generous:
c) At the moment I can't put div's or anything inside the "here" below:
<p id="item1" class="tabcontent">... "here"... </p>
It only seems to like text, and butchers anything I paste into it. Is their any easy way to remedy this?