-1
Good afternoon, I am making an html page and have some blocks that are responsive. Now I need the text displayed inside them to be as well. How can I do this?
-1
Good afternoon, I am making an html page and have some blocks that are responsive. Now I need the text displayed inside them to be as well. How can I do this?
3
An alternative for you to have full control of resizing your sources is to use the media queries of css
:
@media screen and (min-width: 480px) {
p {font-size: 12px;}
}
@media screen and (min-width: 768px) {
p {font-size: 16px;}
}
@media screen and (min-width: 1024px) {
p {font-size: 18px;}
}
In that case you can create as many rules as you think necessary.
The second option would be to actually use em
. Each em
corresponds to the current font size, which by default in browsers is 16px
. That is to say:
p {
font-size: 1em; //16px
}
h1 {
font-size: 2em; //32px
}
h2 {
font-size: 1.5em; //24px;
}
I recommend that before you answer search http://answall.com/search?tab=votes&q=text%20responsive
1
In standard EM, 1 MS usually equals 16 pixels, that is, the measure that the browser considers as standard for texts. Using MS is a question of accessibility, as people with difficulty reading can freely increase and decrease the size of the text in a proportional way. What gives more freedom to the user without breaking its layout!
I leave a option if it’s interesting to you. Note that 16 pixels = 100%, 10 pixels is equal to 62.5%. (16 x 0.625 = 10). If you want makes it much easier to calculate values from a decimal basis. It is possible to define the body worthwhile font-size: 62.5% as standard for the whole document. So make 1em equivalent to 10px
Then it would look like this:
body {
font-size: 62.5%;
}
.bloco {
width: 100%;
}
.bloco p {
font-size: 1em; /* Conforme explicado acima, seria equivalente a 10px */
}
A 12px text, for example, would be equivalent to 1.2em(Read the explanation above). Already a header with 36px would be equivalent to 3.6em(Read the explanation above).
I decided to share this solution that I had applied in a project with needs related to responsive text, freely increase and decrease the text size proportionally.
Beast: 1em = 16px
, 1.6em = 25.6px
Hello, yes, hello! Just to make it 'round', resetting the font-size on the body with font-size: 62.5%; 16 pixels = 100%, 10 pixels equals 62.5%. (16 x 0.625 = 10). Then just set this value as the default for the whole document. Using this rule 1in becomes equivalent to 10px. Sacked?
I understand, so I suggest that you nest the rules in the same block, so that it’s clear!
Thank you! I’ve changed.
I recommend that before you answer search http://answall.com/search?tab=votes&q=text%20responsive
OK! Taking advantage of being logged in, I decided to share a different solution that I had applied in a project with needs related to responsivel text
responsive text*
You can share the oldest questions that already have answers and those that you notice are duplicates just signal, so avoid spreading the content.
Okay. All right! I’ll stay tuned.
Browser other questions tagged html5 css3
You are not signed in. Login or sign up in order to post.
You can use the font-size in "in" and set different sizes for different resolutions
– Leo Letto
You can use "em", "rem", "vh" or "vw"
– RFL
Depending on what you call "responsive", this word does not mean anything in practice (it’s just a silly nickname used by people who are not from the area, commonly used by "marketing" to sell websites). Easier to explain exactly the desired effect/result and the difficulty in obtaining, so you can have technical answers.
– Bacco
Further reading: Why it is recommended to use the "em" unit instead of "px" for fonts?
– Bacco
Possible duplicate of Font Responsiva
– Guilherme Nascimento