Responsive Text
Responsive Font Size
The text size can be set with a
The text size can be set with a
vw unit, which means the "viewport width".
That way the text size will follow the size of the browser window:
Example
<h1 style="font-size:8vw;">Hello World</h1>
<p style="font-size:2vw;">Resize the browser window to see how the font size scales.</p>
<p style="font-size:2vw;">Resize the browser window to see how the font size scales.</p>
Change Font Size With Media Queries
You could also use media queries to change the font size of an element on specific screen sizes:
@media screen and (min-width: 601px) {
div.example {
font-size: 80px;
}}
@media screen and (max-width: 600px) {
div.example {
font-size: 30px;
}}
div.example {
font-size: 80px;
}}
@media screen and (max-width: 600px) {
div.example {
font-size: 30px;
}}
Comments
Post a Comment