Set font for whole page with ONLY html

The way to do it in HTML with inline styles would be:

<body style="font-family: sans-serif">

This will set the global font to sans-serif

You can also put CSS inside a <style> tag like this:

<style>
    * {
      font-family: sans-serif;
    }
</style>

This will give every element a font of sans-serif

For custom fonts you can use Google Fonts

Edit this is the way to achieve it with pure HTML:

After the <body> tag, add the <font> tag with the face attribute of the font you'd like to use. Example usage:

Fiddle Demo:

http://jsfiddle.net/yHRU7/

HTML:

<body>
    <font face='verdana'>
        <div class='htmlVersion'>No css</div>
    </font>
    <div class='cssVersion'>No Extra Html</div>
</body>

CSS:

.cssVersion {
    font-family: verdana;
}

As you can see there is no difference between the results. I advise that normal stylesheets are used - the method used in the CSS version. This is more maintainable and standard.


You can apply css in html with inline css but it's highly recommanded to use an external stylesheet

<body style="font-family:'Verdana'">

Tags:

Html

Css