Something I just figured out the other day: Roll20 has tons of css connected directly to the elements in their app.css and base.css, right on label, button[type="roll"], input[type="checkbox", select, etc. That was the reason we had had to repeat those elements over and over in our css, instead of only using classes. So we have a checkbox <input type="checkbox" class="sheet-sect-show" ... /> we could only reference it with input[type="checkbox"].sheet-sect-show if we were changing one of the attributes that is set in app.css or base.css. That caused a lot of css to be repeated especially if there were 2 or 3 levels of nesting, because we needed a different version of the selector for each type of input that was affected. Yes we (or someone) had overwritten a lot, and we had our own "label", "span", "select" attributes set, but this still presented the same problem. To override those we still needed to use both the element and class in the selector. Yesterday I finally decided to set a few of those attributes to "initial" on the elements, and magically my css has gotten cleaner! I have only spent a few hours testing, but I've been able to eliminate tons of css and element references from our css file. At the top of our css file we now have this, which I built by inspecting odd things on the page and found the setting in app.css and base.css, and whatever attributes those were, reset them to initial, or if they had .ui-dialog in front. After doing that, i can reference those portions of the DOM using only the class, and don't need a whole bunch of other things in the selectors. So right now the top of my css looks like this: label {
margin-bottom:initial;
padding-right:initial;
width:initial;
font-size:inherit;
line-height:1em;
display:inline;
}
select {
width:initial;
}
button[type="roll"] {
margin-left:initial;
margin-right:initial;
}
Obviously a few things on label I set myself still. I've only just begun. But now every single instance of input[type="checkbox"]
label is gone from our css except for the reset to initial on top. I'm still working on textarea, div, select, etc. But this finally lets me have very simple selectors. And I could even remove some of the ^=s and :not()s as well Hopefully this will help speed up the sheet. It sure makes it easier to read.