I am working on a school project : http://lauralynn87.github.io/WSP/Project/index.html
and I am using the framework Bootstrap 3.0 - and almost everything is responsive, but the text.
I've tried using percentages and ems for font sizes..but nothing is working. I know I'm missing something, but can't figure it out.
Any help is appreciated.
Thanks.
Fonts are not responsive if you use %
or em
etc.
If you want to change the size of your font on different screen/window sizes, you have to use media queries in CSS.
For example:
@media all and (max-width: 1200px) { /* screen size until 1200px */
body {
font-size: 1.5em; /* 1.5x default size */
}
}
@media all and (max-width: 1000px) { /* screen size until 1000px */
body {
font-size: 1.2em; /* 1.2x default size */
}
}
@media all and (max-width: 500px) { /* screen size until 500px */
body {
font-size: 0.8em; /* 0.8x default size */
}
}
The numbers are of course only examples.
Here is a mobile first css snippet for screen only using Bootstrap device sizes. Comments:
.
/* xs < 768 */
@media screen and (max-width: 767px) {
body {
font-size: 0.9em;
}
}
/* sm */
@media screen and (min-width: 768px) {
body {
font-size: 1em;
}
}
/* md */
@media screen and (min-width: 992px) {
body {
font-size: 1.2em;
}
}
/* lg */
@media screen and (min-width: 1200px) {
body {
font-size: 1.3em;
}
}
A jsfiddle that shows the effects: https://jsfiddle.net/stevetarver/9a8ym3hL/embedded/result/. Note that the media queries are only changing th, td font sizes, not body as shown above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With