Given that Twitter Bootstrap is designed to be responsive / device-friendly, why doesn't it use relative font sizes?
5 Answers
Well it seems that they are hiding behind the browser zoom excuse. Really sad to see such a heavily used and influential framework completely ignore accessibility issues and a fundamental cornerstone of responsive design. They are in a position of great responsibility and unfortunately seem to have no intention of acting accordingly.
[Update] So today Mark Otto replied on the thread I referenced above. Predictably there is no mention of accessibility and use of the phrase 'pixel-perfect':
Okay, so here's a bit of a background on the decisions of yesteryear and plans for moving forward.
Pixels provide absolute control and consistent rendering across every browser.
Designers still mostly think and operate in pixels.
Browsers scale up entire pages these days, so it's not an issue with type scaling or anything.
Nesting ems historically has been a pain and can require extra math for figure computed/intended pixel values.
Mixing units of measurements is ugly and my inner OCD hates it. Using units on line-height is generally discouraged, but provides immediate knowledge of what the computed value is. We'll probably try to steer away from this in the future. In the future, we'll likely use ems for type sizing, perhaps rems even, but not for anything else. This is also debatable on font sizes for inputs and the like. It's just not how folks build pixel perfect sites.
That's a bit all over and hopefully coherent enough. I'll try to blog about these changes as they come up more, but I'm unsure how close 3.0 is and what that will all entail yet.
I would suggest anyone with strong feelings about this go and +1 this thread.
[Update] V3 roadmap oulined in V2.3 release blogpost makes no mention of adding support for ems.
[Update] Lots more information about Bootstrap V3 available in the pull request here including the following from Mark Otto:
We explored the use of rem units over pixels, but found little benefit to offset the implications of their use. IE8 would still need a pixel fallback, and that's a lot of duplicate lines of code. Moreover, using rems everywhere instead of pixels would exacerbate that problem. Mixing rems and pixels doesn't seem to make sense either right now. However, we can and will continue to evaluate this in future releases.
Then more recently (in its comments):
I highly doubt we'll be shipping with rems at this point. Changing everything—beyond font-sizes—is a huge task and one that comes with few benefits to offset that. Double the lines of code for font-sizes aside, supporting rems in any other way seems tedious at best. That said, we can always revisit in a future release. For now, we're sticking with pixels.
Having grown dissatisfied with a large number of Bootstrap's features, not least of which is it's lack of em-support, I strongly suggest looking at Susy if you just want grids, or Zurb Foundation 4 for the whole enchilada. Don't let Bootstrap's popularity cloud your judgement. Anyone can build something with Bootstrap, which is exactly its problem - it's designed for people with minimal web-experience. Just because there are lots of McDonalds' in the world doesn't mean it's a healthy place to eat.
[Edit] OK. This was a silly thing to say. Since I wrote this, I've used BS3 and it has upped its game considerably. I shouldn't have made such a throwaway comment, but I still believe that it has made a bad decision in using pixels for font-sizing. As well as accessibility issues, ems are useful in other ways.
[Update] Looks like rems will be supported in V4 (Mdo quoted from here):
For those following along, we'll be able to change from pixels to REMs in v4 when we drop IE8 support. Can't do much until then.
[Update Feb '17] Bootstrap 4 is still in Alpha, but shows use of rems in its Typography docs, but doesn't show use of rems in its layout docs.

- 1
- 1

- 42,754
- 56
- 195
- 331
-
4The problem is that it looks like there is nobody here to explain why it is more "accessibility friendly" to use EM more than PX. I mean ok, on the paper it seems obvious, but in real life? Does anyone have REAL examples of users stucked on pixel based websites? With real stats and real problems that pixels causes? This is the real question in this debate I think. The lack of proof is why most of people use PX. – adriendenat Aug 01 '13 at 11:14
-
7Operating system level and browser level fonts are increased by those with vision problems. `em` is required for such people, hence "accessibility". – Steven Vachon Aug 18 '13 at 22:31
-
1There's a discussion here which explains why font size increasing is better than zoom, http://webaim.org/discussion/mail_thread?thread=5849 "I spoke to someone at CSUN last year that pointed out that zooming in on the entire page is not all that helpful to him. He has very low vision and he does need to increase the size of the text on a page fairly significantly in order to read it. However, when you use page zoom, you end up having to scroll left and right in order to read text and that gets old really fast. It's very easy to lose your place when you have to do that." – tony Jun 05 '14 at 08:36
-
4Em-based sizes are also integral to mobile development. Device manufacturers spend money and time determining the *optimal* base font size for legibility on their device. We invalidate all of that research when we say "font-size: 14px." What does that mean on UltraAwesomeRetina3.0? Or on a 52" screen with lower pixels-per-inch? Leaving the base font size up to the manufacturer is a best-practice, plain and simple. http://filamentgroup.com/lab/how-we-learned-to-leave-body-font-size-alone.html http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/ – Jay Dansand Jul 29 '14 at 17:52
-
3Since I’m a (let’s just call it) EM fanatic, I love the fact you kept updating this answer… and even more that you pointed to alternatives. **+1** ;) – e-sushi Feb 26 '15 at 14:35
-
The Bootstrap v4 alpha switched to `rems`, but v4 alpha 2 switched back to `px`: "Reverted media queries and grid containers from rems to pixels as viewports are not affected by font-size." – Rudey Feb 25 '16 at 12:49
-
BS4 uses ems throughout the code, but undoes all the hard work by sticking `html { font-size: 16px; }` at the top. :bangs head on desk:. For anyone interested, I’ve opened an issue: https://github.com/twbs/bootstrap/issues/19460 – keithjgrant Mar 10 '16 at 15:35
-
@RuudLenders—That comment refers to media queries. There is no benefit to using ems for media queries, as it behaves the same regardless of the page’s font size. – keithjgrant Mar 10 '16 at 15:36
-
As far as I understand, accessibility issues applied to IE6 strictly. In 2016, IE6 is dead and thus accessibility is no longer a viable factor. Consequently, pixel method is by far superior. – Daniel Viglione Jun 20 '16 at 02:15
-
Yes, Bootstrap V4 uses pixels for screen-splits, what about Bootstrap **V5?** – Top-Master Aug 02 '22 at 09:56
Don't let Bootstrap's popularity cloud your judgement. Anyone can build something with Bootstrap, which is exactly its problem - it's designed for people with minimal web-experience. Just because there are lots of McDonalds' in the world doesn't mean it's a healthy place to eat.
You could argue not to let it cloud your judgement in a negative way. It's a solid framework and if you bother to invest the time into how to use it effectively, the majority of your argument falls on it's head.
Whilst it's often used by people with minimal experience - and there's nothing wrong with that - it's also used by people with a lot of experience.
At very least, it's an invaluable prototyping tool. At very best, it's completely customisable. You can pick and choose, modify, add to - which is why it's called a 'framework'.
I've been using it effectively on some of my projects for over two years - it's as lean as you want it to be. I've used just the form framework, just the grids, the entire codebase and customised it to suit my needs. In many ways, it's 'upped' my game, getting me further into preprocessing, using variables, honing the way I structure projects.
Yes, there are some issues. px
for font sizes and using Less are two.
However, because it's entirely open source, you can find options to remedy both of those easily.
I investigated Foundation and liked what I saw, but I'm in the unfortunate position of having to support IE8, as many devs are. Foundation has dropped support for IE8, making it a 'no go' for me. Despite this, I'm not about to dismiss an entire framework, most specifically something that is free to use and free to modify based solely on a few issues!
Heck, in one project, I lifted parts of Foundation and parts of Bootstrap and added my own custom code - that's the beauty of open source.

- 11,812
- 19
- 76
- 129

- 2,712
- 1
- 17
- 15
-
6That's totally fair enough and to be honest, with Bootstrap 3, I think it has really stepped up its game. In retrospect it was a bit of a silly thing to say, but it was born out of frustration and I still think the majority of sites I see that use Bootstrap use it very lazily. It is a great tool for prototyping and for non-public facing pages - admin areas etc. It can also be a great tool for public-facing sites if the person using it understands how to style beyond its defaults. Like any tool it is easily abused, and I suppose the ease of use is what results in the amount of (ab)use. – Undistraction Nov 01 '13 at 14:21
-
2Yeah, I hear you - sometimes you just so incensed with coding, you lash out :) At least, with bootstrap 3.0, when abused, there's *some* standards in place. The same applies to Foundation. There's lots that can be learned from both. Ultimately, given the time, 'rolling your own' is the way forward. – Matthew Trow Nov 04 '13 at 09:48
-
2Posting an answer to comment on another answer is somewhat confusing… (just saying) – e-sushi Feb 26 '15 at 15:09
-
Nice to see some balance brought to this :) Bootstrap works well for a lot of people, experienced and newb alike. – Aaria Carter-Weir Aug 10 '15 at 04:12
-
If you still prefer Bootstrap with em and rem support you can take a look at this - https://github.com/ivayloc/twbs-rem-em there is no need to make any calculation to convert pixels in rem or em units, there is build in @mixins
for this - @include rem(property, values)
- also fallback to px and for em convertion you can use em(value)
.

- 365
- 4
- 14
-
I'm no longer using TBS as I've found Foundation to be much better thought out, however this looks like a good compromise. – Undistraction Jul 08 '14 at 16:11
Whilst I use Bootstrap extensively, there's a few areas where accessibility takes the back burner. I guess there's inevitable trade-offs with a platform that's used so extensively.
I completely get why they've opted to retain pixels for font-size. The inheritance issues with em's for a framework's fonts are a total nightmare.
rems are an alternative option, but browser support is still problematical.
You could create your own rems mixin and replace every line of less which uses the base font size variable.
That's the beauty of bootstrap - and frameworks like it - it's a solid base to work from.
Yes, I've mentioned there's elements to twitter bootstrap which aren't that accessible - one small example, the use of 'display: none' instead of using clip. I'm pretty damn sure there's a valid reason for this - and again, you can very easily modify this if you want.
Bootstrap isn't flawless, but then, I doubt it was ever intended to be the final answer to all your requirements. It's a base - a 'bootstrap' - learn it and utilise it properly, add to it, mix it all up - at the very least, it's an awesome framework to prototype with, or to throw together a quick site. Going further, there's some really solid groundwork within that can be applied to any website.

- 42,754
- 56
- 195
- 331

- 29
- 1
-
1I think one of the ironies of Bootstrap is that it does so much more than 'bootstrap' your application. It is prescriptive on so many levels, no least of which is layout. Apart from laziness, the reason why so many sites are so obviously bootstrap-based is that it isn't all that easy to break away from the defaults. Yes there are a handful of variables to customise aspects, but the hideous specificity issues make overriding other aspects a massive headache. Maybe Bootstrap 3 will be better. Personally, I'm liking Foundation 4. It makes me feel like it's me in charge rather than the framework. – Undistraction Jul 15 '13 at 20:22
i think, its because of the desktop first approach. Twitter Bootstrap is responsive friendly, but "graceful degradation" approach.

- 54
- 1
- 3