css font size responsive code example
Example 1: responsive font-size
font-size: clamp(40px, 10vw, 70px);
Example 2: how to make fonts respnsive
h1 {
font-size: clamp(16px, 5vw, 34px);
}
Example 3: responsive text css
@media screen and (min-width: 25em){
html { font-size: calc( 16px + (24 - 16) * (100vw - 400px) / (800 - 400) ); }
}
@media screen and (min-width: 25em){
html { font-size: calc( 16px + (24 - 16) * (100vw - 400px) / (800 - 400) ); }
}
@media screen and (min-width: 50em){
html { font-size: calc( 16px + (24 - 16) * (100vw - 400px) / (800 - 400) ); }
}
Example 4: css size
#myID {
height: 100px;
width: 200px;
}
.myClass {
height: 220px;
width: 40px;
}
Example 5: how to make font responsive
html { font-size: calc(1em + 1vw); }