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

Can't vertical-align tags

I'm using HTML <label> elements for all my non-dynamic character sheet labels. With the below CSS, I can't seem to get them vertical-align: middle - they are top-aligned everywhere on my sheet. Minor, but annoying. I've included a sample of the surrounding HTML layout, which uses CSS grid. (Note: I've tried using grid's align-self: center but no impact. <div class="sheet-overview"> <div class="grid-main"> <div class="grid-sub2"> <label>Player:</label> <input type="text" name="attr_player" /> <label>Name:</label> <input type="text" name="attr_character_name" /> <label>Gender:</label> <input type="text" name="attr_gender" /> <label>Class:</label> <input type="text" name="attr_class" /> <label>Title:</label> <input type="text" name="attr_title" /> <label>Alignment:</label> <select name="attr_alignment"> <option value="law">Law</option> <option value="neutrality">Neutrality</option> <option value="chaos">Chaos</option> </select> </div>     </div> </div> .sheet-grid-main { display: grid; grid-template-columns: 50% 50%; row-gap: 10px; } .sheet-grid-sub2 { display: grid; grid-template-columns: 33.3% 66.6%; } .sheet-grid-sub2 > .sheet-grid-title { grid-column: span 2; justify-self: start; } .sheet label { display: inline; font-size: 1em; font-weight: normal; }
1587965452
GiGs
Pro
Sheet Author
API Scripter
Vertical-align is often a pain in CSS, at least for me. One way of doing this is to apply the CSS to the label and inputs .sheet-grid-sub2 label {     display: block;      height: 25px;      line-height: 30px;  } .sheet-grid-sub2 input {     height:30px } Giving the label a height and line-height, and the input a matching height, might do the job. Note that the height and line-height on the label can be equal, but often yoi get better results by making one slughtly larger than the other. It's often trial-and-error to find which works. But the height of the input should match the line-height of the label, i think. Another way to do this is to add a top-margin to the label or input, nudging it up or down to match the desired position of the other.
1588005979

Edited 1588006001
Line-height yielded some results, but not without expanding the height of all my content rows (and their text fields) - a side-effect of grid behavior, presumably. However, I was wondering about this statement on the Roll20 help page,  Intro to Sheet Creation , under the "Static Info" section: <label> : Good for labelling input fields. Is by default bold font and leaves extra space under itself (Emphasis mine.) Using the element selection tool in the browser (Chrome) developer tools, I noticed that a Roll20 container style was forcing a margin-bottom: 10px  property. I overrode this in my <label> style and reduced the line-height and voila! Thanks for the help! Final CSS: label { display: inline; font-size: 1em; font-weight: normal; line-height: 25px; margin-bottom: 0px; } (Note: VSC complains about setting a margin property on display: inline , but if it's instead set to block , then   where I've used <labels> in repeating sections they all cause wrapping and break the UI. As long as it works, I'm good...)
1588007130
GiGs
Pro
Sheet Author
API Scripter
Oh yes, forgot to mention the inbuilt styles. This is one of the advantages of inspecting html, to try to find the stuff roll20 adds to each element so you can delete it if necessary.