Comments (14)
This might be a slightly unpopular decision, but I decided to use padding-*
and margin-*
instead of pad-*
and mar-*
One, it's more clear what's actually being applied at a glance. And they're only a few chars more than mar-
and pad-
anyway.
Two, it's more consistent with the rest of the utility classes:
.float-left {}
.width-50 {}
.height-100 {}
.text-center {}
.padding-y-big {}
.margin-x-none {}
I don't think the extra chars will be a problem since in all likeliness you'll only ever apply one or two to the same element:
<div class="padding-y-big margin-x-small">
...
</div>
And at least now we don't have microformat collisions π
from shoelace.
Data attributes are explicitly specified to only be for the site itself, not for external reuse:
Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.
These attributes are not intended for use by software that is independent of the site that uses the attributes.
They are also meant for non-visible data. Using microformats means you can use the text shown on the page as data, rather than a parallel version that may go out of date. This DRY issue is the problem with JSON-LD too, as well as its complexity. I wrote about this with examples.
Microformats are in active use by the indieweb protocols including webmention and micropub. I've written about possible collisions with u- prefixes before too.
Microformats 2 are explictly designed to minimise clutter, and are terser than alternatives that require extra versions of the text like JSON-LD and OGP.
from shoelace.
Possibly. What exactly is it conflicting with?
from shoelace.
Microformats uses short prefixes on class names to indicate that they should be parsed as data. A prefix of h- defines a structure, and within that other prefixes define field names. The p- prefix is used for plaintext properties (the most common case).
Because of this convention, your padding prefix could cause spurious properties to show up in a parsed structure, and potentially confuse people reading source as whether padding or an mf2 property was intended.
More info on the prefixes here: http://microformats.org/wiki/microformats2-prefixes
from shoelace.
Ugh, why would they use classes? They should have used data attributes (or even better, JSON-LD).
If this gets changed, I'd prefer pad-*
like you suggested, but also mar-*
for consistency. They're still short and relevant, albeit more verbose.
I'm gonna let the community vote on this with π (change) and π (no change) to determine if this gets changed.
from shoelace.
Are microformats even relevant anymore?
from shoelace.
That's sorta what I'm wondering, plus I feel it's a poor implementation. I used JSON-LD for Postleaf and everything gets parsed fine.
I get that it's supposed to be "easier" for humans to write (is it though?) but it really clutters up markup and I think we have better alternatives nowadays.
Of course, I'm not the only one using the Internet so I'll let others provide feedback π
from shoelace.
Fair points, can't argue with the standard. How does pad-*
and mar-*
sound?
The other option is to use a BS-style naming convention: p[dir]-[size]
and m[dir]-[size]
but that sorta deviates from our own convention. π
from shoelace.
I think pad-* and mar-* are a good compromise between terseness and clarity. Certainly much better than the overloading of u- in the article I linked.
from shoelace.
A little bit off topic, could you please clarify what's the correct syntax to use the margin and / or padding? Based on this post I did some experiment, however neither mar-t-20 or margin-t-20 is working:
{if isset($entry->summary)}
<div class="alert alert-light margin-t-20">
<strong>{eval var=$entry->summary}</strong>
</div>
{/if}
Thanks!
from shoelace.
All the classes are here:
https://github.com/claviska/shoelace-css/blob/master/source/css/utilities.css#L200
from shoelace.
Thank you. The following line does work. Is it also possible to give a number of pixels as argument?
<div class="row mar-t-sm">
from shoelace.
No β the spacing utilities are designed to be relative to the spacing variables.
If you need exact pixels, the recommended approach is a custom class (or an online style if thatβs your preference).
from shoelace.
Thanks for explaining.
from shoelace.
Related Issues (20)
- refactor stopAnimations function
- Input prefix and suffix not displaying in react.
- SlButton Clicks Not Suppressed when in Loading State HOT 3
- Switch doesn't allow setting `aria-describedby` HOT 1
- Update "Form Controls" documentation to be more explicit
- Tooltip has some accessibility/screenreader issues around reading content HOT 1
- Empty radio-group leads to exception HOT 3
- <sl-select> with "muiltiple" only sends a single item to FormData, when more than one is selected. HOT 1
- Close Event force closing other element [ Dialog, dropdown, drawer] HOT 5
- `<sl-rating precision>` sometimes doesn't reset when leaving with the mouse
- `scrollbar-gutter: stable` conflicting with overlayed UI components (e.g. dialog, drawer) HOT 2
- <sl-button type="submit" form="formId"> throws exception when it's unmounted
- sl-remove event cannot be prevented from triggering dropdown HOT 2
- Focus trapping in Firefox + `<sl-select>` do not behave as expected
- Radio Group's `getAllRadios` doesn't support slots HOT 1
- 'sl-select multiple' shrinks and doesn't show full options HOT 6
- When wrapping a `<sl-menu-item>` default slot with HTML, the submenu controller can render inconsistently.
- Form controls submit even when disconnected HOT 8
- Checkboxes won't change checked/unchecked from keyboard HOT 6
- hoist doesn't work with 'contain: paint' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shoelace.