Code Monkey home page Code Monkey logo

Comments (4)

garrypolley avatar garrypolley commented on May 24, 2024

I'm no expert but I think cell-padding attribute will get the most consistent experience cross browser. If the desire is to keep using CSS I'd make this selector:

.my_table--special-case td {
    padding: 10px;
}

from getbem.github.io.

ssougnez avatar ssougnez commented on May 24, 2024

Hi,

isn't against the BEM principle to use "td" selector?

from getbem.github.io.

garrypolley avatar garrypolley commented on May 24, 2024

In my opinion it's not "against" BEM to use an HTML tag in a selector.

I think table is an example of where it makes sense to do it. Tables have a specific markup pattern that is almost always required in order to get a proper table. Therefore, I don't think that the selector specificity issues that BEM generally helps avoid matters in this particular case.

That's why I favored a block--modifier tag approach for the selector. I'm sure others have thoughts on this topic as well. I'm not an "expert" at BEM, I've been using it at just about a year and I think there are cases where using tags makes sense, and tables is the cleanest case in my opinion. The key being that it's still based off a block--modifier and not only styling the tag.

from getbem.github.io.

adi518 avatar adi518 commented on May 24, 2024

I'd say it falls around the same context portrayed here: http://getbem.com/faq/#block-modifier-affects-elements

However, If you are writing your table dynamically, I'd use .table__td--modifier. This way you adhere to convention and avoid issues later on, when you want to elaborate your td design.

from getbem.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.