Skip to content

Why does Bootstrap use “btn” classes? #32068

Answered by mdo
henrydaggett asked this question in Ideas
Discussion options

You must be logged in to vote

This is a super old post from me, but it hits at the heart of it: https://markdotto.com/2012/02/16/scope-css-classes-with-prefixes/. A talk I last gave years ago also explains the approach even more: https://speakerdeck.com/mdo/at-mdo-ular-css. And then there's https://getbootstrap.com/docs/4.5/extend/approach/#classes.

Bottom line, .primary is meaningless without btn- in front of it. Attaching it to button.primary makes the class more specific, or more difficult to override later.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MartijnCuppens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants