Comment on Show HN: Basic.css – Classless CSS Starter FileparentComments−torstenvl6ySeems 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.−smichel176yThe 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.−err4nt6yIf you want to do this, look into autonomous custom elements, you can make something like `<x-card>` …no class name required!−kitd6yA workaround might be little more than running a sed command on the html sources before bundling.−VWWHFSfQ6ywhy not just write <div class="card">−airstrike6y<s>Not nearly as cool as <.card>, sorry</s>−werdnapk6yOr use a template engine. Slim for example allows you to write just .card
Comments
Seems like it would be awesome if HTML allowed you to set a default element
and then use as a shorthand for You could be "classless" to the extent of being semantic and succinct but without having to misappropriate elements.The 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.
If you want to do this, look into autonomous custom elements, you can make something like `<x-card>` …no class name required!
A workaround might be little more than running a sed command on the html sources before bundling.
why not just write <div class="card">
<s>Not nearly as cool as <.card>, sorry</s>
Or use a template engine. Slim for example allows you to write just .card