Comments (4)
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.
Hi,
isn't against the BEM principle to use "td" selector?
from getbem.github.io.
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.
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)
- Can I use block element inside another nested block?
- What's the relationship between getbem.com and bem.info? HOT 1
- Block Inside Blcok HOT 1
- Typo on getbem's CSS
- Is nesting necessary in some situations?
- Does Yandex use BEM in correct way?
- Where is a definitive guide?
- Can a DOM element be an element of two or more blocks?
- FAQ: What if some styles only apply to 1 element type?
- Hello the website content is not readable. Please make it bold and darker color.
- Republish getbem to GitHub pages
- Can blocks have other blocks as children, or only elements are allowed?
- BEMify tailwind classes
- Internationalize site
- Move socials and navigation links to hamburger-like button on small screens
- Fix default theme in shikiConfig
- ToC on mdx pages HOT 4
- Restyle introduction and naming
- Convert html elements in mdx to markdown
- Make code smaller on sm size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getbem.github.io.