Have you tried: #content{font-size:1.2vw;}
. The vw
unit will adjust to screen width (there is also a vh
unit that adjusts to screen height). Get the size right and it should always shrink the font to an appropriate size.
The vw
unit divides the screen width into 100 units, and assigns size based on desired number of units. Similar to percent, but not reliant on parent. See this explanation at CSS-Tricks
Alternately, explore CSS media queries. They work like this:
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
#content{font-size:8px;}
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
#content{font-size:9px;}
}
/* Small Devices, Tablets */
#content{font-size:10px;}
}
/* Medium Devices, Desktops */
@media only screen and (min-width : 992px) {
#content{font-size:12px;}
}
/* Large Devices, Wide Screens */
@media only screen and (min-width : 1200px) {
#content{font-size:14px;}
}
/*========== Non-Mobile First Method ==========*/
/* Large Devices, Wide Screens */
@media only screen and (max-width : 1200px) {
#content{font-size:14px;}
}
/* Medium Devices, Desktops */
@media only screen and (max-width : 992px) {
#content{font-size:12px;}
}
/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
#content{font-size:10px;}
}
/* Extra Small Devices, Phones */
@media only screen and (max-width : 480px) {
#content{font-size:9px;}
}
/* Custom, iPhone Retina */
@media only screen and (max-width : 320px) {
#content{font-size:8px;}
}
Resources:
https://css-tricks.com/viewport-sized-typography/
Bootstrap 3 breakpoints and media queries
https://scotch.io/tutorials/default-sizes-for-twitter-bootstraps-media-queries