3 ms·
Seems like it would be awesome if HTML allowed you to set a default element <meta default-element="div"> and then use <.card> as a shorthand for
by torstenvl 6y ago
Seems like it would be awesome if HTML allowed you to set a default element
<meta default-element="div">
and then use
<.card>
as a shorthand for
<div class="card">
You could be "classless" to the extent of being semantic and succinct but without having to misappropriate elements.
- err4nt 6y agoIf you want to do this, look into autonomous custom elements, you can make something like `<x-card>` …no class name required!
- VWWHFSfQ 6y agowhy not just write <div class="card">
- airstrike 6y ago<s>Not nearly as cool as <.card>, sorry</s>
- smichel17 6y agoThe yesod web framework's hamlet templates have this, albeit without the default as far as I know. <section .card> compiles to <section class="card">. If you omit the element, it uses div by default so you can use just <.card> if you prefer.
- werdnapk 6y agoOr use a template engine. Slim for example allows you to write just .card
- kitd 6y agoA workaround might be little more than running a sed command on the html sources before bundling.