Skip to content

How to name a tag wrapper #150

@pankopiotr

Description

@pankopiotr

I was wondering whether a tag element which is wrapping other content, is considered a block?
Let's consider this vanilla code:

          <div>
            <a href='#'>
              <p>Some random paragraph</p>
              <img src='stylesheets/assets/onion.jpg'>
            </a>
          </div>

Code below considers a tag as normal element.

          <div class="news-box">
            <a class="news-box__link" href='#'>
              <p class="news__content">Some random paragraph</p>
              <img class="news-box__image" src='stylesheets/assets/onion.jpg'>
            </a>
          </div>

While this code considers a tag as block that wraps p and img:

          <div class="news-box">
            <a class="news" href='#'>
              <p class="news__content">Some random paragraph</p>
              <img class="news-__image" src='stylesheets/assets/onion.jpg'>
            </a>
          </div>

Which approach is better/valid and why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions