Teckenstorlek i CSS
Låt oss lära oss att ändra teckenstorlek. För
detta används egenskapen font-size,
som tar ett värde i pixlar.
Låt oss sätta teckenstorleken för styckestext till 30
pixlar:
<p>
This is a paragraph with text.
</p>
p {
font-size: 30px;
}
:
Kopiera följande HTML-kod till din sida:
<h1>Main page title</h1>
<p>
This is a paragraph with text.
</p>
<h2>Secondary heading 1</h2>
<p>
This is a paragraph with text.
</p>
<p>
This is a paragraph with text.
</p>
<h2>Secondary heading 2</h2>
<p>
This is a paragraph with text.
</p>
<p>
This is a paragraph with text.
</p>
Sätt teckenstorlek för rubriken h1
till 50px och centreringsjustering, för rubriker
h2 sätt teckenstorlek till 40px och ta bort
fetstil, och för stycken sätt teckenstorlek till 30px.