
Hello folks, I've run into a little snag, I'm tried to work out just how I can add radio button tabs to my character sheet. I have some code that seems to work but when I try to add some style to it and make it look a bit better than just the buttons things seem to fall apart. I feel I have some middling knowledge of CSS, I know the codes and how things are constructed.. Pseudo-classes or whatever the "::" "~" stuff not withstanding, (dont understand any of that and never will no matter how well those tutorial websites explain it.) I learn by listening to people explain and showing how it works. But thats another issue. I have some code that I've been trying to get to work for a while and I've given up on getting it to work myself. I was wondering if someone might be able to take a look at it and see what's wrong. I have the code I've been working on here <a href="http://jsfiddle.net/2Dm83/" rel="nofollow">http://jsfiddle.net/2Dm83/</a> . I just to know, I would love also to be able to increase the size of the radio button to fill the entire h4's area and then make it invisible. But, I'll settle for actually getting it to work first. Also, yes I know I could probably do this with <spans> and <divs>. But they are severely overused and it makes it harder for me to keep my code up to date when everything in existence uses the same two html tags over and over again. ---------------- I just noticed the jsfiddle link does not give the right code for what I'm working on, so I have to type it in here manually: The CSS code is: .sheet-character-sheet { display: none; }
h4 {
border: 1px solid white;
padding: 0.5em;
margin: -3px;
display: inline;
position: relative;
top: -8px;
left: -7px;
background-color: black;
color: white;
font-size: 1em;
font-weight: bold;
text-align: center;
}
.isPC:checked ~ .sheet-pc,
.isNPC:checked ~ .sheet-npc, .isSpells:checked ~ .sheet-spells {
display: block;
} And the HTML is: <h4><input type="radio" class="isPC" value="1" name="attr_pc" checked> PC</h4>
<h4><input type="radio" class="isNPC" value="0" name="attr_pc"> NPC</h4>
<h4><input type="radio" class="isSpells" value="0" name="attr_pc"> SPELLS</h4>
<div class="sheet-character-sheet sheet-pc">
<div>
Something Clever for PCs here!
</div>
</div>
<div class="sheet-character-sheet sheet-npc">
<div>
Something Clever for NPCs here!
</div>
</div>
<div class="sheet-character-sheet sheet-spells">
<div>
Something Clever for Spells here!
</div>
Yeah so that's what I have so far, any help would be very much appreciated.