Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic classes for non native components #133

Open
jakobrosenberg opened this issue Jun 23, 2020 · 2 comments
Open

Semantic classes for non native components #133

jakobrosenberg opened this issue Jun 23, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@jakobrosenberg
Copy link

jakobrosenberg commented Jun 23, 2020

Cool project! Have you considered a few semantic classes like card.

I'm not proposing the typical solution where elements are bloated with classes, but instead only use classes when there isn't a native HTML tag.

Typical CSS markup

<div class="card">
  <div class="card-header">
    <div class="card-title">
      <h3>My card</h3>
    </div>
  </div>
  <div class="card-content">
    <p>Lorem ipsum</p>
  </div>
  <div class="card-footer">
     <div class="card-buttons">
       <div class="button">Click me</div>
     </div>
  </div>
</div>

The dream

<article class="card">
  <header><h3>My Card</h3></header>
  <main>Lorem ipsum</main>
  <footer><button>Click me</button></footer>
</article>

I get the classless motivation, but I find that the answer to one extreme is rarely the opposite extreme, but a healthy balance. I hope this is something you'll consider. 🙂

@EvgenyOrekhov EvgenyOrekhov added the enhancement New feature or request label Jun 23, 2020
@EvgenyOrekhov
Copy link
Owner

Thanks!

I don't want to turn holiday.css into Bootstrap/Bulma/whatever. I want to keep the scope small.

Regarding your specific example, I think it would be really hard to create a generic "card" component using a single class that would work well with different use cases. Some might want to put a text header into it, some might want an image header, or an accordion.

So, I would like to leave creating custom components to the consumer of the library.

Perhaps, once I figure out a proper way to support theming (#132), and a proper way to separate "base", "full", and "extended" stylesheets (#84), then maybe I will consider having some advanced components. But I would rather have them made by somebody else :) Perhaps something like third-party "plugins" for holiday.css?

And I'm totally with you on "The dream" example. No need to create classes for every single sub-element, especially when you can use semantic ones.

BTW, you can't have more than one <main> element on a page (unless the other ones are hidden), according to HTML spec.

@EvgenyOrekhov
Copy link
Owner

And here is a card for you: https://jsfiddle.net/ne2hgjbt/1/ :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants