Set Font Size With Pixels

Setting the text size with pixels (absolute size) gives you full control over the text size:

HTML file: Displayed by browser:
<style>
h1 {
    font-size: 40px;
}
h2 {
    font-size: 30px;
}

p {
    font-size: 12px;
}
</style>
<body>
<h1>Default H1 heading.</h1>
<h1 class="demo">H1 heading of 40px.</h1>
<h2>Default H2 heading.</h2>
<h2 class="demo">H2 heading of 30px.</h2>
<p>This is a default paragraph.</p>
<p class="demo">This is a paragraph of 12px.</p>
</body>

Default H1 heading.

H1 heading of 40px.

Default H2 heading.

H2 heading of 30px.

This is a default paragraph.

This is a paragraph of 12px.

Tip: If you use pixels, you can still use the zoom tool to resize the entire page.

Back button Table of Contents Next button