I’m not a super experienced coder by any means, but I’ve been playing around a lot with neocities. I have a page going that I like how it looks so far, but I can’t get it to actually function. I’m basically trying to get the category divs on the left to show the corresponding text to the right. Here’s a visual if that helps.
I’ve been googling a lot, looking through SO answers, tutorials, etc and trying to apply what I’ve found but I think I’m just not sure how to plug what where. (also I don’t want to visually turn the "buttons" on the left into the "buttons" that seem to be the default when using the "button" element).
.bio {
margin: auto;
height: 100%;
width: 100%;
font-family: 'Franklin Gothic';
display: flex;
}
.bio-cat-holder {
width: 20%;
height: auto;
padding: 20px;
}
.bio-cat {
background: #9c2f2f;
color: #bbbbbb;
border: 2px solid #bbbbbb;
height: 30px;
width: 100%;
font-family: 'VT323';
font-size: 30px;
padding-top: 4px;
text-align: center;
padding-bottom: 4px;
margin-top: 10px;
margin-left: 2%;
margin-bottom: 1%;
margin-right: 20px;
float: left;
}
.bio-text-box {
height: auto;
border: 2px solid #bbbbbb;
float: right;
margin: 10px;
flex: 1;
padding: 15px;
}
<div class="bio">
<div class="bio-cat-holder">
<div class="bio-cat">GENERAL INFORMATION</div>
<div class="bio-cat">SKILLS & ABILITIES</div>
<div class="bio-cat">CATEGORY 3</div>
<div class="bio-cat">CATEGORY 4</div>
<div class="bio-cat">CATEGORY 5</div>
<div class="bio-cat">CATEGORY 6</div>
<div class="bio-cat">CATEGORY 7</div>
</div>
<div class="bio-text-box">
<div class="general">Blah Blah Blah Biography</div>
<div id="skills">Blah blah blah skills</div>
</div>
</div>
2
Answers
I followed what you’re doing and here’s the code I ended up with. And I think this is somehow doing what you want, based on my understanding. So here’s what I did in summary:
For this you need javascript adding click event listner.
For your case it can be done like this,
Check how I used ID’s with javascript. If you need to reduce the code you can use jquery library or foreach loop.