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 not floating to sides

1589849430
Chomik
Pro
Sheet Author
I try to put two sheets sections right next to one another - but they do not seems to 'listen' to my commands. I want to put Personality section next to Basic one - to not lose space. Here is HTML: <div class="sheet__basic"> <label> Name: </label> <input class="input" type="text" name="attr_character_name" /> <br/> <label> Calling and Level: </label> <input class="input" type="text" name="attr_calling_level" /> <br/> <label> Subrace - Breed, House, etc: </label> <input class="input" type="text" name="attr_subrace" /> <br/> <label> Family: </label> <input class="input" type="text" name="attr_family" /> <br/> <label> Background: </label> <input class="input" type="text" name="attr_background" /> </div> <div class="sheet__personality"> <h2>Personality Traits</h2> <label> <bold>Ideal</bold> - What is most important to me ... </label> <br/> <textarea></textarea> <br/> <select id="personality"> <option value="bond"><label> <bold>Bond</bold> - I am inspired by my bond to ... </label></option> <option value="mystery"><label> <bold>Mystery</bold> - No one knows about... </label></option> </select> <br/> <textarea></textarea> <br/> <label> <bold>Flaw</bold> - No matter what, I just can't ... </label> <br/> <textarea></textarea> <br/> </div> And here is relevant CSS: .sheet__basic { grid-area: basic; border: 2px solid blue; float: left; } .sheet__personality { width: 60%; grid-area: personality; border: 2px solid blue; float: right; } textarea.sheet__personality { width: 60%; }
1589849911

Edited 1589850075
Andreas J.
Forum Champion
Sheet Author
Translator
Using float is pretty archaic. Look here for examples of sheet design, and try using them: <a href="https://wiki.roll20.net/Designing_Character_Sheet_Layout" rel="nofollow">https://wiki.roll20.net/Designing_Character_Sheet_Layout</a> Yes, you should be able to make it work with floats, but I strongly encourage you to use any of the methods/examples mentioned in the article. The problem you have is likely that the second div is too wide or some of it's component is too wide, so if you force each subcomponent to be under 50% with, it might work.
1589879022

Edited 1589879074
Chomik
Pro
Sheet Author
So the area looks the same, even if I tried to make Grid layout and smaller divs. :( Here is my CSS snipets: .sheet { display: grid; grid-gap: 8px; grid-template-areas: ". logo logo logo basic basic basic . " ". attributes proficiency proficiency descriptions descriptions descriptions . " ". attributes extended extended descriptions descriptions descriptions . " ". attributes defense defense descriptions descriptions descriptions . " ". attributes defense defense descriptions descriptions descriptions . " ". attributes defense defense skills skills skills . " ". attributes stamina stamina skills skills skills . " ". attributes dice dice skills skills skills . " ". attributes death-save-failure death-save-failure personality personality personality . " ". rucksack rucksack rucksack personality personality personality . " ". tricks tricks tricks spell-slots spell-slots spell-slots . " ". tricks tricks tricks spell spell spell . " ". back back back spell spell spell . " ". back back back sketch sketch sketch . "; grid-template-columns: 1fr repeat(6, minmax(100px, 1fr)) 1fr; grid-auto-flow: column; grid-auto-columns: 1fr; } /*Configure the tab buttons*/ .sheet-character, .sheet-npc, .sheet-rack_spells { display: none; } /* show the selected tab */ .sheet-tabstoggle[value="character"] ~ div.sheet-character, .sheet-tabstoggle[value="npc"] ~ div.sheet-npc, .sheet-tabstoggle[value="rack_spells"] ~ div.sheet-rack_spells { display: block; } .sheet__logo { grid-area: logo; border: 2px solid blue; } .sheet__logo__image { width: 60%; } textarea { width: 100%; height: 60%; box-sizing: border-box; } .input { max-width: 100%; float: right; clear: both; } .sheet__basic { grid-area: basic; grid-row:1; grid-column:1; border: 2px solid blue; float: left; } .sheet__personality { grid-row:1; grid-column:2; width: 40%; grid-area: personality; border: 2px solid blue; float: right; } textarea.sheet__personality { width: 40%; }
1589886366
Finderski
Plus
Sheet Author
Compendium Curator
I don't know if this is going to affect anything, but, is there a reason you're using underscores in some of your classes? For example:&nbsp;sheet__personality Maybe try changing those to the usual hyphen: sheet-personality
1589889344
GiGs
Pro
Sheet Author
API Scripter
Well spotted, those underscores will definitely be breaking those classes. You can use underscores in class names perfectly fine, but your clases must start with sheet- , and that must be a dash not an underscore.
1589891078
Andreas J.
Forum Champion
Sheet Author
Translator
Wow, I forgot to check the code for <a href="https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes</a> , even though I'm the one who wrote that section. On a related note, I updated the Building Character Sheets -article with a "General" &amp; "Sheet Structure" sections so the "sheet-" thing is mentioned in even more places right now. As with your Grid code attempt, if you actually use grid-template-areas like I do, I encourage you to add extra spaces to align the names in a grid so the overview also easily shows visually the sheets structure. Not that many other major sheet authors uses grid-template-areas as larger grid end sup being more cumbersome like in your example, as well as prevents you from having overlapping section. This is how I'd have the grid-template-areas if this was my code: grid-template-areas: ". logo logo logo basic basic basic . " ". attributes proficiency proficiency descriptions descriptions descriptions . " ". attributes extended extended descriptions descriptions descriptions . " ". attributes defense defense descriptions descriptions descriptions . " ". attributes defense defense descriptions descriptions descriptions . " ". attributes defense defense skills skills skills . " ". attributes stamina stamina skills skills skills . " ". attributes dice dice skills skills skills . " ". attributes death-save death-save personality personality personality . " ". rucksack rucksack rucksack personality personality personality . " ". tricks tricks tricks spell-slots spell-slots spell-slots . " ". tricks tricks tricks spell spell spell . " ". back back back spell spell spell . " ". back back back sketch sketch sketch . "; Much easier for a quick overview, and noticing any possible mistakes, right? I usually also try name the areas with not too long names, so that as much "formatting" isn't needed of the section. Here I shortened "death-save-failure" to just "death-save" for that reason.