Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 2
Why and How font sizes specified in HTML and CSS as "small" and "x-large" work together!?
When we write in HTML <p class="small"> Para in small <\p> And in CSS p.small { font-size: x-large; } The output comes out In X-large!! So which is the deciding factor!? https://code.sololearn.com/Ws17uyxjIWj5/?ref=app
2 Respostas
+ 4
The class name doesn't matter, it could be anything; the content of it counts
+ 1
Yes the class=āsmallā is a container word, like in Algebra, X=whatever. So āsmallā in this situation is a container word. You then tell the browser using CSS what āsmallā means, in this case your telling the browser small means āx-largeā so now every time the browser sees the word āsmallā in your HTML it knows to make your text x-large, because you told it to in your CSS.
In this solo learn app, making the class name āsmallā when your actually assigning the size in your CSS, makes the class name alittle bit deceptive because the class name doesnāt mean anything, it can be, essentially, whatever you want it to be.
It could be class=ābananasā as long as your CSS assigns the desired attributes bananas can mean whatever you want it to mean. So this:
HTML
<p class=ābananasForYouā> This is my text </p>
CSS
p.bananasForYou {
font-size: x-large;
}
this will also make your text X-large.
The reason why they use class=āsmallā in HTML and then in your CSS font-size: small;
is to make your code a little eaiser to read/navigate. Especially if someone else is reviewing your code.