-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Along the lines of #19, I am finding a lot of the class names unintuitive and inconsistent.
I really think the class names should favour clarity and ease-of-use over brevity, and lean on what developers should know about CSS.
Developers should know the property and value they want to apply to an element and it should be less effort for them to write class names of the property and value they want than to think about how its associated utility class name is formatted.
My suggestion is to use the format .[property name]-[property value] for all CSS utilities that only modify the value of one property. e.g. .margin-0 instead of .m-0, .align-items-stretch instead of .items-stretch, .text-transform-none instead of .normal-case, .max-width instead of .container.
Examples of some inconsistencies
- Some class names come from the property:
.pointer-eventsforpointer-events.appearanceforappearance.resizeforresize
- Some class names come from the attribute's value:
.blockfordisplay: block;.flexfordisplay: flex;.visibleforvisibility: visible
- Some class names come from some combination of property and value, with something omitted:
.items-stretchforalign-items: stretch.flex-rowforflex-direction: row.table-autofortable-layout: auto
- Some class names use terminology that isn't used in CSS:
.invisibleforvisibility: hidden.trackingforletter-spacing.normal-casefortext-transform: none;
- Some class names mix up terminology that is used in CSS:
.justifyforjustify-content, nottext-align: justify.textforfont-size, nottext-transform.alignforvertical-align, notalign-items
- Some class names use abbreviations:
.mformargin.zforz-index.pforpadding
Additionally, I think there are some class names that could reasonably be used for components or layout utilities. This would be mitigated if utility classes were named after their respective CSS property and value.
.blockcould be a boxy layout element.contentcould be a content-containing element.selectcould be a select input.scrollingcould be a state class to use with JS
This would also better distinguish single-property utility classes from complex utility classes such as:
.clearfix.list-reset.truncate
Andd I'm not sure if it's already a functionality that exists, but maybe developers can shorten the base class names according to their own preferences. I think it would be best to mimick CSS by default, though.
Related Issues:
#413 .font-normal .font-regular .roman .font-not-italic
#577 .hidden .visible
#102 and #523 Customizable class names