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

CSS Grid Difficulties - Everything Is Stacked, Not In Grid

Hey all, I am wondering if someone could take a look at my CSS and HTML for a character sheet and help me understand why the grid is not being properly laid out? The CSS for this sheet is adapted from the example Grid-based sheet, and the HTML is super simple. I wanted to get a handle on how to do this before I tried anything super fancy. Here is the CSS: /*----------------- MAIN LAYOUT ------------------*/ .main { display: grid; width: 900px; height: 1200px; grid-gap: 4px; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; grid-template-rows: 90px 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr; grid-template-areas:"header header header header header header" "bonus bonus common common traits traits" "bonus bonus common common truths truths" "vulnerability vulnerability common common truths truths" "vulnerability vulnerability common common truths truths" "resistance resistance common common truths truths" "resistance resistance common common truths truths" "gettingaround gettingaround common common truths truths" "gettingaround gettingaround common common truths truths"; } /*----------------- GENERAL CSS ------------------*/ section { padding: 5px; border-style: solid; } /* CSS Flexbox styling, used for adjusting how content inside section behaves */ .f-col { display: flex; flex-direction: column; } .f-row { display: flex; flex-direction: row; } .wrap { display: flex; flex-wrap: wrap; } .nowrap { display: flex; flex-wrap: nowrap; } .f-center { align-items: center; justify-content: center; } /*----------------- Text &amp; Input styling -----------------*/ @import url("<a href="https://fonts.googleapis.com/css?family=Lexend&amp;display=swap" rel="nofollow">https://fonts.googleapis.com/css?family=Lexend&amp;display=swap</a>"); /* these are for overwriting default CSS that comes from Roll20 */ .charsheet * { font-family: "Lexend"; } .charsheet h3{ text-align: center; } .charsheet label{ margin: 3px; padding: 3px 0 0 0; } .charsheet input[type="text"], input[type="number"]{ margin: 2px 4px; } .charsheet textarea { width: 95%; height: 85%; } /*------------- Section-specific CSS -------------*/ .header { grid-area: header; background-color: olive; flex-direction: column; } .bonus { grid-area: bonus; background-color: orange; justify-content: space-evenly; } .traits { grid-area: traits; background-color: orange; justify-content: space-evenly; } .truths { grid-area: truths; background-color: orange; justify-content: space-evenly; } .common { grid-area: common; background-color: brown; } .vulnerability { grid-area: vulnerability; background-color: green; } .resistance { grid-area: resistance; background-color: grey; } .gettingaround { grid-area: gettingaround; background-color: chocolate; } Here is the HTML: &lt;main&gt; &lt;section class="header f-center"&gt; &lt;input name="attr_archetype" type="text" /&gt; &lt;/section&gt; &lt;section class="traits f-col nowrap"&gt; &lt;label&gt;Traits:&lt;/label&gt; &lt;input name="attr_trait1" type="text"/&gt; &lt;input name="attr_trait2" type="text" /&gt; &lt;/section&gt; &lt;section class="truths"&gt; &lt;label&gt;Truths:&lt;/label&gt; &lt;textarea name="attr_truths"&gt;&lt;/textarea&gt; &lt;/section&gt; &lt;section class="common"&gt; &lt;label&gt;Notes:&lt;/label&gt; &lt;textarea name="attr_notes"&gt;&lt;/textarea&gt; &lt;/section&gt; &lt;section class="bonus f-col nowrap"&gt; &lt;label&gt;Archetype Bonus:&lt;/label&gt; &lt;label&gt;Name:&lt;input name="attr_archetypebonus" type="text"/&gt;&lt;/label&gt; &lt;textarea name="attr_bonusnotes"&gt;&lt;/textarea&gt; &lt;/section&gt; &lt;section class="vulnerability"&gt; &lt;label&gt;Vulnerability:&lt;/label&gt; &lt;textarea name="attr_vulnerabilitynotes"&gt;&lt;/textarea&gt; &lt;/section&gt; &lt;section class="resistance"&gt; &lt;label&gt;Resistance:&lt;/label&gt; &lt;textarea name="attr_resistancenotes"&gt;&lt;/textarea&gt; &lt;/section&gt; &lt;section class="gettingaround"&gt; &lt;label&gt;Getting Around:&lt;/label&gt; &lt;textarea name="attr_gettingaroundnotes"&gt;&lt;/textarea&gt; &lt;/section&gt; &lt;/main&gt;
1629298433

Edited 1629298447
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
your problem is that you are doing the grid layout in a class called main , but you are just using a &lt;main&gt; tag. Change your first CSS line .main{ &nbsp;to main{ &nbsp;or add the class main &nbsp;to the &lt;main&gt; &nbsp;tag.
Thanks to Scott and Andreas - the sheet is mostly working now. Just ironing out bugs.
Oddly, the Lexend font stopped working part way through troubleshooting. I have not touched the related CSS.
1629360455

Edited 1629360917
Oosh
Sheet Author
API Scripter
From MDN : Imported rules must precede all other types of rules, except @charset rules; as it is not a nested statement , @import cannot be used inside conditional group at-rules . Chuck your @import right at the top and it should be good.
Yep. That helped. Thanks!