1
Good morning, can someone help me give me a tip on how to get the current font size so I can enlarge it next? ps: I am using the Angularjs for the functions!
1
Good morning, can someone help me give me a tip on how to get the current font size so I can enlarge it next? ps: I am using the Angularjs for the functions!
1
Hello,
There are several ways to do this, one of them is using the pseudo-selector focus
. Below are two examples, one increasing with scale
and another with font-size
:
#bt-1:focus {
transform: scale(1.5);
}
#bt-2:focus {
font-size: 30px;
}
<p><button id="bt-1">Click para aumentar</button></p>
<p><button id="bt-2">Click para aumentar</button></p>
Browser other questions tagged html css angularjs
You are not signed in. Login or sign up in order to post.
Can I ask why you want to increase the font? It would be a case of CSS queries?
– Sergio
I need to click the button and make it grow or decrease and can do it by css
– Gabriel Souza
Okay, I thought it would be case to increase/decrease depending on the screen size. Then CSS would be better. But in this case you need some Javascript, even if CSS makes changes with classes. Explain better then the HTML you have and how much you want it to grow etc...
– Sergio
There is a way to recognize font size via javascript?
– Gabriel Souza
Yes, with
window.getComputedStyle(el).fontSize
– Sergio
How about the universal dial: What is the asterisk in "* {}" in CSS?
– Marconi
Thank you Sergio!
– Gabriel Souza
Marconi, I don’t understand the purpose of using this selector
– Gabriel Souza
* { font-size: 15px}
will apply a source of 15 pixels to all tags @Gabrielsouza– Marconi
@Gabrielsouza, if you give more details about your problem you will have better answers to your problem. Just as it is we’re still guessing what’s in the code.
– Sergio
@Sergio, thanks a lot for the help, I managed to achieve the goal using window.getComputedStyle(el). fontsize
– Gabriel Souza
@Gabrielsouza great! So mark as duplicate of another similar question to get more organized.
– Sergio
As others have said, the context of your doubt is unclear. But it may be the case to use relative units in your CSS, such as
em
or%
. (CC @Sergio).– bfavaretto