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

I Need Help w/ the Built In Column Lay-out, Please

<a href="https://wiki.roll20.net/Designing_Character_Sheet_Layout#Roll20_columns.2Frows" rel="nofollow">https://wiki.roll20.net/Designing_Character_Sheet_Layout#Roll20_columns.2Frows</a> I've tried it both with the "sheet-" tag and without, as one page says it's needed and another says it is not.&nbsp; No matter how I change it, I can't get it to appear in columns.&nbsp; Here is my craptastic code and the result.
1724729994

Edited 1724730535
vÍnce
Pro
Sheet Author
Hi Roger, Pretty sure that those built-in css classes need "sheet-".&nbsp;col should be "sheet-col" as well. Have you tried using legacy mode with your code? <a href="https://wiki.roll20.net/Legacy_Sheet" rel="nofollow">https://wiki.roll20.net/Legacy_Sheet</a> In a custom game you toggle the legacy option in the game settings page. In the sandbox I think you'll need to add legacy: true { "legacy" : true } to the sheet.json editor. (BTW also post the actual code vs a screen shoot.&nbsp; Makes it WAY easier for someone to help.&nbsp; Especially with copy/pasting answers and examples.) I highly encourage you to build a non-legacy sheet and give css-grid a try. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Basic_concepts_of_grid_layout" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Basic_concepts_of_grid_layout</a> Cheers
1724734794

Edited 1724735585
GiGs
Pro
Sheet Author
API Scripter
Judging by the screenshot, you are using both versions in the same file? You shouldnt need to use the sheet- part in the html - you need it in CSS if using a legacy sheet. Like Vince, I also recommend building a non-legacy sheet. Then you can follow the guidance here (designed for beginners to coding sheets!): <a href="https://cybersphere.me/roll20/" rel="nofollow">https://cybersphere.me/roll20/</a> Also I would suggest building your sheet using CSS Grid. The example on that page is more complex than it needs to be. Let's say you built your sheet HTML exactly the same, but instead of sheet-2colrow, have &lt;div class="col2"&gt; &lt;!-- all your code, but remove class="col" - keep the divs, just remove the class&gt; &lt;/div&gt; Then in your CSS have div.col2 { display: grid: grid-templay-columns: 1fr 1fr; column-gap: 5px; } And that's it - an instant 2 equal-width column layout. Just add extra 1fr on that line to add extra columns. You can nest grids inside each other, and change the width, like grid-templay-columns: 40% 60%; or a 4-column width using %, fr (fractions), and px (pixels) grid-templay-columns: 50px 80px 1fr 20%; PS: I want to emphasize Vince's point: if posting code, always post the actual code, not a screenshot. My code example would have been bigger if I could have just copied your code.
Okay, what you gave me made complete sense and I assumed it'd work because it's simple, but I am clearly screwing something up somewhere.&nbsp; Here is the entirety of my code. div.col2 { display: grid: grid-template-columns: 1fr 1fr; column-gap: 5px; } &lt;div class="col2"&gt; &lt;div&gt; &lt;h2&gt;Defenses&lt;/h2&gt; &lt;h3&gt;Shields:&lt;/h3&gt; &lt;input type="number" name="attr_shields" value="0"&gt; &lt;p&gt;&lt;/p&gt; &lt;h3&gt;Head&lt;/h3&gt; Armor &lt;input type="number" name="attr_head_a" value="0"&gt; Health &lt;input type="number" name="attr_head_h" value="0"&gt; &lt;p&gt;&lt;/p&gt; &lt;h3&gt;Body&lt;/h3&gt; Armor &lt;input type="number" name="attr_body_a" value="0"&gt; Health &lt;input type="number" name="attr_body_h" value="0"&gt; &lt;p&gt;&lt;/p&gt; &lt;h3&gt;Left Arm&lt;/h3&gt; Armor &lt;input type="number" name="attr_larm_a" value="0"&gt; Health &lt;input type="number" name="attr_larm_h" value="0"&gt; &lt;p&gt;&lt;/p&gt; &lt;h3&gt;Right Arm&lt;/h3&gt; Armor&lt;input type="number" name="attr_rarm_a" value="0"&gt; Health &lt;input type="number" name="attr_rarm_h" value="0"&gt; &lt;p&gt;&lt;/p&gt; &lt;h3&gt;Left Leg&lt;/h3&gt; Armor&lt;input type="number" name="attr_lleg_a" value="0"&gt; Health &lt;input type="number" name="attr_lleg_h" value="0"&gt; &lt;p&gt;&lt;/p&gt; &lt;h3&gt;Right Leg&lt;/h3&gt; Armor &lt;input type="number" name="attr_rleg_a" value="0"&gt; Health &lt;input type="number" name="attr_rleg_h" value="0"&gt; &lt;/div&gt; &lt;div&gt; &lt;h2&gt;Weapons, Drones, Etc&lt;/h2&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;input type="text" value="Weapon Name"&gt; Ammunition &lt;input type="number" value="0"&gt; Battery &lt;input type="number" value="0"&gt;&lt;br&gt; &lt;/div&gt; &lt;/div&gt;
1724817788
vÍnce
Pro
Sheet Author
Hi Roger, what isn't working with your new code?&nbsp; Maybe post a screen shot as well.&nbsp; Also, make sure you are not in legacy mode if you are not prepending "sheet-" in the html and "sheet." in the css.
1724818092

Edited 1724818406
GiGs
Pro
Sheet Author
API Scripter
I had a typo in my original code. Oops! The CSS should have been: div.col2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 5px; } Notice the colon after grid has changed to a semi-colon. All lines inside CSS declarations should end in a semi-colon. And as Vince points out, this is modern, non-legacy code. If you are using legacy code, everything else is the same, just change this one part: div. sheet- col2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 5px; } No changes are needed in the HTML.
1724818312

Edited 1724818679
GiGs
Pro
Sheet Author
API Scripter
PS, if you want to use absolute widths, without changing the sizes of any inputs, etc., you can probably do this: div.col2 { display: grid; grid-template-columns: 175px 430px ; column-gap: 5px; } (Those are the minimum widths I found, rounded to nearest multiples of 5px - you probably wouldnt want to use those exactly.)
1724822038

Edited 1725298523
GiGs
Pro
Sheet Author
API Scripter
By the way, you don't need those &lt;p&gt;&lt;/p&gt; bits - the &lt;h3&gt; automatically starts a new line, and HTML doesn't show white space (&lt;p&gt;&lt;/p&gt; with nothing inside them) . Remember how I said grids can be nested? You could do that with both divs. Here's one way to do it. First, any bare text has to be put in a tag - here, I've used spans. See the Armor and Health entries. &lt;div class="col2"&gt; &lt;div class="col2-left"&gt; &lt;h2&gt;Defenses&lt;/h2&gt; &lt;h3&gt;Shields:&lt;/h3&gt; &lt;input type="number" name="attr_shields" value="0"&gt; &lt;h3&gt;Head&lt;/h3&gt; &lt;span&gt;Armor&lt;/span&gt; &lt;input type="number" name="attr_head_a" value="0"&gt; &lt;span&gt;Health&lt;/span&gt; &lt;input type="number" name="attr_head_h" value="0"&gt; &lt;h3&gt;Body&lt;/h3&gt; &lt;span&gt;Armor&lt;/span&gt; &lt;input type="number" name="attr_body_a" value="0"&gt; &lt;span&gt;Health&lt;/span&gt; &lt;input type="number" name="attr_body_h" value="0"&gt; &lt;h3&gt;Left Arm&lt;/h3&gt; &lt;span&gt;Armor&lt;/span&gt; &lt;input type="number" name="attr_larm_a" value="0"&gt; &lt;span&gt;Health&lt;/span&gt; &lt;input type="number" name="attr_larm_h" value="0"&gt; &lt;h3&gt;Right Arm&lt;/h3&gt; &lt;span&gt;Armor&lt;/span&gt; &lt;input type="number" name="attr_rarm_a" value="0"&gt; &lt;span&gt;Health&lt;/span&gt; &lt;input type="number" name="attr_rarm_h" value="0"&gt; &lt;h3&gt;Left Leg&lt;/h3&gt; &lt;span&gt;Armor&lt;/span&gt; &lt;input type="number" name="attr_lleg_a" value="0"&gt; &lt;span&gt;Health&lt;/span&gt; &lt;input type="number" name="attr_lleg_h" value="0"&gt; &lt;h3&gt;Right Leg&lt;/h3&gt; &lt;span&gt;Armor&lt;/span&gt; &lt;input type="number" name="attr_rleg_a" value="0"&gt; &lt;span&gt;Health&lt;/span&gt; &lt;input type="number" name="attr_rleg_h" value="0"&gt; &lt;/div&gt; &lt;div class="col2-right"&gt; &lt;h2&gt;Weapons, Drones, Etc&lt;/h2&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;input type="text" value="Weapon Name"&gt; &lt;span&gt;Ammunition&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;span&gt;Battery&lt;/span&gt; &lt;input type="number" value="0"&gt; &lt;/div&gt; &lt;/div&gt; Secondly, the HTML ignores all white space by default - that means spaces and linebreaks. So you can organise the code in a way that makes it easy for you to read. It has its own rules for how to pirint those on a character sheet (like headings by default starton a new line, and spans and inputs don't. Thats why I have empty space in there, btw - so I can easily see where a column should end. Now we make those left and right columns each their own grid. First, couldnt how many columns we want each to have. They can be different. I could do this: div.col2 { display: grid; grid-template-columns: 300px 430px; column-gap: 5px; } div.col2 div.col2-left { display: grid; grid-template-columns: auto auto auto auto auto; column-gap: 5px; } div.col2 div.col2-right { display: grid; grid-template-columns: auto auto auto auto auto; column-gap: 5px; } These create 5 column layouts, so you don't need those &lt;br&gt; entries - if there are more than 5 entries, they automatically go to the next line. There are a couple of problems to sort out. First, the h2 headings at the start are treated as the first column, so we need to modify them so they stretch across the fll width of the grid. We can do this like this: div.col2 h2 { grid-column: 1 / -1; } This targets any h2 elements inside the div.col2 area, and says make this column start in the first column, and end in the last column (-1 means last). Then we notice in the left grid, the fact that shields in the first row only has one entry but the rest have more, which messes up the columns. We can fix that with some CSS targetting the H3s, like so: div.col2 h3 { &nbsp; &nbsp; grid-column : 1 / 2 ; } This means those headings take up the first column, but you could instead still want them to take up a row so could do this: div.col2 h3 { &nbsp; &nbsp; grid-column : 1 / -1 ; } If you do that, you probably want to drop that dv.col2 width back to grid-template-columns: 175px 430px; There are more efficient ways to write this code. In CSS, you can separate declarations with a comma, and it will apply all declarations as if their were separate entries. For example: div.col2 , div.col2 div.col2-left , div.col2 div.col2-right { &nbsp; &nbsp; display : grid ; &nbsp; &nbsp; column-gap : 5px ; } div.col2 { &nbsp; &nbsp; grid-template-columns : 190px 430px ; } div.col2 div.col2-left { &nbsp; &nbsp; grid-template-columns : repeat(auto , 4) ; } div.col2 div.col2-right { &nbsp; &nbsp; grid-template-columns : repeat(auto , 5) ; } div.col2 h2 , div.col2 h3 { &nbsp; &nbsp; grid-column : 1 / -1 ; &nbsp; } Basically, you can figure out everything that has the same entry (like those display:grids at the start) and put them in a shared declaration using commas to separate each item. You could also create that layout with those h3 entries on the same line: div.col2 , div.col2 div.col2-left , div.col2 div.col2-right { &nbsp; &nbsp; display : grid ; &nbsp; &nbsp; column-gap : 5px ; } div.col2 { &nbsp; &nbsp; grid-template-columns : 300px 430px ; } div.col2 div.col2-left { &nbsp; &nbsp; grid-template-columns : repeat(5, auto ) ; } div.col2 div.col2-right { &nbsp; &nbsp; grid-template-columns : repeat(5, auto ) ; } div.col2 h2 { &nbsp; &nbsp; grid-column : 1 / -1 ; &nbsp; } div.col2 h3 { &nbsp; &nbsp; grid-column : 1 / 2 ; &nbsp; } Using CSS makes it easy to try out different layouts or styles without having to mess with the HTML. One more complication: If you put the h3 entries as the first column, they cause the inputs to stretch upwards (their height matches the heading), so you would need to either change the height of the h3 or the inout, which you could do with something like: div.col2 div.col2-left input { height: 24px; } You'd need to experiment with the height, probably. Anyway, I hope this crashcourse is useful! PS: that second column would be a lot more erlegant with a repeating section - you can look into that at your leisure and come back with questions :) You'll also ned to add name properties to the inputs in the second column - a repeating section makes that a lot easier ftrom a design point of view.
1724855422

Edited 1724855473
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Vince and gigs have given awesome advice. The only thing I'll add is that you almost never want to include the type selector in your css rule (e.g. div.col2 ). First of all, this locks you into always using diva for this layout, which you might not always want. Second of all it adds an unnecessary layer of specificity to your css which can make it hard to override the styling if you need to later on in your code. Instead, just use the class selector.
1724870561
GiGs
Pro
Sheet Author
API Scripter
Thanks for the praise which makes me feel awful to say this, but I think there are times it is good to use the type selector. You can get away without using it here, but I included it so it did specifically just apply to those divs. Likewise, here div.col2 h2 I could have written that as .col2 h2 but I'd still be using a type selector (h2), and I think thats better than adding a class to the h2 when it's just not needed. I have a feeling this discussion will be over the head of OP - if you don't follow it, just ignore it.
1724877437
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Heh, I agree with you on when it's good to use the type selectors. I was a little too general in my post, but I was mostly talking about doing things like the div.col2 &nbsp;where you're targeting just a single thing being a place where it's better to not use them.
Thank you, thank you, thank you! I have learned so much from all of your posts. You guys all rock.