I have an application that runs on Android and IOS.
The application has some WebView components that displays HTML
From what I found there are "em" and "viewport" units
as well as "@media" in css.
I'm new to HTML5 and CSS3, can someone, please, show me an example of responsive font size for mobile devices.
The most important for me is to have a different font size between mobile phones and tablets,
but also between different screen size of mobile devices (for portrait and landscape orientations).
The WebView component are not full screen, they in size of a textbox and the size is dynamic.
Use in media queries
HTML
<p class="fonts">Administrator</p>
Add media queries
@charset "utf-8";
/* CSS Document */
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
.fonts
{
font-size: 75%;
}
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
.fonts
{
font-size: 120%;
}
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
.fonts
{
font-size: 120%;
}
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
.fonts
{
font-size: 120%;
}
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
.fonts
{
font-size: 150%;
}
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
.fonts
{
font-size: 120%;
}
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
.fonts
{
font-size: 156%;
}
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
.fonts
{
font-size: 200%;
}
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
.fonts
{
font-size: 190%;
}
}
I use % for font size, here is just example of fonts size, try it and add % what you think is the best
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