I'm using Bootstrap 3 to build a responsive layout where I want to adjust a few font sizes according to the screen size. How can I use media queries to make this kind of logic?
相关问题
- How to add a “active” class to a carousel first el
- Should I use CSS3 media queries to deliver differe
- Full Clickable Accordion in Bootstrap
- How to add Bootstrap 4 without Tether?
- Laravel overriding bootstrap template
相关文章
- Make Bootstrap tab Active on the bases of URL link
- Rails: Twitter Bootstrap Buttons when visited get
- Reduce spacing between rows
- How do use bootstrap tooltips with React?
- How to control print font size
- Need to design 8 boxes in two rows
- Trigger a Bootstrap .collapse('toggle') vi
- How to override Bootstrap mixin without modifying
Use media queries for IE;
If you're using LESS or SCSS/SASS and you're using a LESS/SCSS version of Bootstrap, you can use variables as well, provided you have access to them. A LESS translation of @full-decent's answer would be as follows:
There are also variables for
@screen-sm-max
and@screen-md-max
, which are 1 pixel less than@screen-md-min
and@screen-lg-min
, respectively, typically for use with@media(max-width)
.EDIT: If you're using SCSS/SASS, variables start with a
$
instead of a@
, so it'd be$screen-xs-max
etc.keep in mind that avoiding text scaling is the main reason responsive layouts exist. the entire logic behind responsive sites is to create functional layouts that effectively display your content so its easily readable and usable on multiple screen sizes.
Although It is necessary to scale text in some cases, be careful not to miniaturise your site and miss the point.
heres an example anyway.
Also keep in mind the 480 viewport has been dropped in bootstrap 3.
Bootstrap 3
Here are the selectors used in BS3, if you want to stay consistent:
Note: FYI, this may be useful for debugging:
Bootstrap 4
Here are the selectors used in BS4. There is no "lowest" setting in BS4 because "extra small" is the default. I.e. you would first code the XS size and then have these media overrides afterwards.
Update 2018-12-26: BS3 info is still accurate as of version 3.4.0, updated BS4 for new grid, accurate as of 4.2.1.