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 Wizardry : Styling Select Dropdowns

1610683165
Jiboux
Pro
Sheet Author
Compendium Curator
Hi there, I am trying to implement in a sheet the trick given on&nbsp; <a href="https://wiki.roll20.net/CSS_Wizardry#Styling_Select_Dropdowns" rel="nofollow">https://wiki.roll20.net/CSS_Wizardry#Styling_Select_Dropdowns</a> <a href="http://jsfiddle.net/ojvq39oo/" rel="nofollow">http://jsfiddle.net/ojvq39oo/</a> The code is pretty clever to create a pseudo &lt;select&gt; with A container (sheet-child) A set of divs, that don't display, except for the one that corresponds to the value of a radio input. Also if the container is hovered, the div actually disappears to leaves space to: The radio inputs and attached labels that are in display: none ... except if hovered on the container That would all be nice and lovely except it&nbsp; doesn't appear in roll20 the way it appears in jsfiddle. For a mysterious reason, the radio buttons and labels don't line up correctly and are all messed up. I tried many things in the css including: Playing with the inline/inline-block/block display that styles the input and label which looks like the ones that actually regulate the alignment that is messed I end up with results like: O 1 O 2 O 3 or O 1 O 2 O 3 Looking at example online it seems that there are 2 ways that work correctly to line up correctly a radio: &lt;div&gt; &lt;input radio value 1&gt; &lt;label&gt; 1&lt;/label&gt; &gt;/div &lt;div&gt; &lt;input radio value 2&gt; &lt;label&gt; 2&lt;/label&gt; &gt;/div or &lt;label display:block&gt; &lt;input radio value 1&gt; &nbsp;1&lt;/label&gt;&nbsp; &nbsp;&lt;label display:block&gt; &lt;input radio value 2&gt; &nbsp;2&lt;/label&gt;&nbsp; Both work well to re-align the radio... But now it is the logic to display the divs that is messed up because the CSS styling to make reappear the chosen div doesn't see the input radio that is encapsulated .sheet-pseudo-select:not(:hover) input.sheet-select-radio.sheet-option10:checked ~ div.sheet-option10{display: block;} I m pretty out of ideas... any suggestions ?&nbsp;
1610683615
Jiboux
Pro
Sheet Author
Compendium Curator
Well stop looking... &lt;br&gt; did the trick...
1610684581
GiGs
Pro
Sheet Author
API Scripter
roll20 has a bunch of styles already applied to various elements, that were likely causing some layout issues. Sometimes you need to override the inbuilt styles, with a CSS reset approach.
1610749319
Jiboux
Pro
Sheet Author
Compendium Curator
Thanks !