Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Lining DIVs and hiding them.

Hi, I'm kinda noob in html and get stuck on a specific thing i try to achive for a new character sheet. So I have a "fatigue" attribute with a value from 1 to 5 that linked to radio buttons. What i want, is 3 lines of checkboxes under them and i want the number of checkboxes to be equal to the arrtibute. But i can't seem to line it up correctly. My code : I tried to put each row on a separate div but then all the checkboxes disapear.
1529524206
Andreas J.
Forum Champion
Sheet Author
Translator
 You could take a quick looks at some of the World of Darkness (cWoD/nWoD) sheets as many are made with radio buttons, maybe some of them have done what you are trying to do. Are you doing your sheet from scratch, or have you used some code from sheets that might have similar layout as you have visioned?
1529529323

Edited 1529529704
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It would also help to post the code as actual text using the code formatting on the forums. This will allow us to more easily see what the code is, critique, and give specific examples of problems. Now that that is out of the way, I see a few problems with your code. you need to name any input that you are using. If an input doesn't have a name, then any changes a user makes to that input are not saved, and cannot affect anything else on the sheet via autocalc or sheetworker; css changes would still occur, but since the value wouldn't be stored, would be reset upon a refresh or log out/log in. This is in reference to the checkboxes you are trying to display. It looks like you are using the old column display css that roll20 provides as an integrated styling setup. I would recommend doing this a different way (there are several options depending on what you want to do, one of which I'm going to demonstrate for the answer to the next issue) Your html is doing some needless div nesting, i'd try this instead: HTML &lt;div class='grid-col'&gt; &nbsp; &nbsp; &lt;div class='fatigue-container'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='fatigue-radio fatigue1' type='radio' name='attr_fatigue' value='1' checked&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='fatigue-radio fatigue2' type='radio' name='attr_fatigue' value='2'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='fatigue-radio fatigue3' type='radio' name='attr_fatigue' value='3'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='fatigue-radio fatigue4' type='radio' name='attr_fatigue' value='4'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='fatigue-radio fatigue5' type='radio' name='attr_fatigue' value='5'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line1 fatigue1' type='checkbox' name='attr_line1_1' value='1'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line1 fatigue2' type='checkbox' name='attr_line1_2' value='2'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line1 fatigue3' type='checkbox' name='attr_line1_3' value='3'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line1 fatigue4' type='checkbox' name='attr_line1_4' value='4'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line1 fatigue5' type='checkbox' name='attr_line1_5' value='5'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line2 fatigue1' type='checkbox' name='attr_line2_1' value='1'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line2 fatigue2' type='checkbox' name='attr_line2_2' value='2'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line2 fatigue3' type='checkbox' name='attr_line2_3' value='3'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line2 fatigue4' type='checkbox' name='attr_line2_4' value='4'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line2 fatigue5' type='checkbox' name='attr_line2_5' value='5'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line3 fatigue1' type='checkbox' name='attr_line3_1' value='1'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line3 fatigue2' type='checkbox' name='attr_line3_2' value='2'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line3 fatigue3' type='checkbox' name='attr_line3_3' value='3'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line3 fatigue4' type='checkbox' name='attr_line3_4' value='4'&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input class='line3 fatigue5' type='checkbox' name='attr_line3_5' value='5'&gt; &nbsp; &nbsp; &lt;/div&gt; &lt;/div&gt; CSS .sheet-fatigue-container{ &nbsp; &nbsp; display:grid; &nbsp; &nbsp; grid-template-columns:[fatigue1-start] 1fr [fatigue1-end fatigue2-start] 1fr [fatigue2-end fatigue3-start] 1fr [fatigue3-end fatigue4-start] 1fr [fatigue4-end fatigue5-start] 1fr [fatigue5-end]; &nbsp; &nbsp; grid-template-rows:[radio-start] 20px [radio-end line1-start] 20px [line1-end line2-start] 20px [line2-end line3-start] 20px [line3-ene]; &nbsp; &nbsp; grid-gap:5px; } .sheet-fatigue-radio{ &nbsp; &nbsp; grid-row:radio-start / radio-end; } .sheet-line1{ &nbsp; &nbsp; grid-row:line1-start / line1-end; } .sheet-line2{ &nbsp; &nbsp; grid-row:line2-start / line2-end; } .sheet-line3{ &nbsp; &nbsp; grid-row:line3-start / line3-end; } .sheet-fatigue1{ &nbsp; &nbsp; grid-column:fatigue1-start / fatigue1-end; } .sheet-fatigue2{ &nbsp; &nbsp; grid-column:fatigue2-start / fatigue2-end; } .sheet-fatigue3{ &nbsp; &nbsp; grid-column:fatigue3-start / fatigue3-end; } .sheet-fatigue4{ &nbsp; &nbsp; grid-column:fatigue4-start / fatigue4-end; } .sheet-fatigue5{ &nbsp; &nbsp; grid-column:fatigue5-start / fatigue5-end; } .sheet-fatigue-container &gt; input[type=checkbox]{ &nbsp; &nbsp; display:none; } input[type=radio].sheet-fatigue1:checked ~ input[type=checkbox].sheet-fatigue1, input[type=radio].sheet-fatigue2:checked ~ input[type=checkbox].sheet-fatigue1, input[type=radio].sheet-fatigue2:checked ~ input[type=checkbox].sheet-fatigue2, input[type=radio].sheet-fatigue3:checked ~ input[type=checkbox].sheet-fatigue1, input[type=radio].sheet-fatigue3:checked ~ input[type=checkbox].sheet-fatigue2, input[type=radio].sheet-fatigue3:checked ~ input[type=checkbox].sheet-fatigue3, input[type=radio].sheet-fatigue4:checked ~ input[type=checkbox].sheet-fatigue1, input[type=radio].sheet-fatigue4:checked ~ input[type=checkbox].sheet-fatigue2, input[type=radio].sheet-fatigue4:checked ~ input[type=checkbox].sheet-fatigue3, input[type=radio].sheet-fatigue4:checked ~ input[type=checkbox].sheet-fatigue4, input[type=radio].sheet-fatigue5:checked ~ input[type=checkbox].sheet-fatigue1, input[type=radio].sheet-fatigue5:checked ~ input[type=checkbox].sheet-fatigue2, input[type=radio].sheet-fatigue5:checked ~ input[type=checkbox].sheet-fatigue3, input[type=radio].sheet-fatigue5:checked ~ input[type=checkbox].sheet-fatigue4, input[type=radio].sheet-fatigue5:checked ~ input[type=checkbox].sheet-fatigue5{ &nbsp; &nbsp; display:block; } You can read more about css grid at these sites: <a href="https://css-tricks.com/snippets/css/complete-guide" rel="nofollow">https://css-tricks.com/snippets/css/complete-guide</a>... <a href="https://gridbyexample.com/examples/" rel="nofollow">https://gridbyexample.com/examples/</a> <a href="https://learncssgrid.com/" rel="nofollow">https://learncssgrid.com/</a> Hope that helps, Scott EDIT: This gives a layout&nbsp; like so
Yeah, i used a lot of the Ars Magica sheet as i'm too noob to creat code form scratch. That said : That's awesome ! It works perfectly. Thank you very much.
1529531769
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Np, we all start somewhere