HTML Fonts
From w3cyberlearnings
Contents |
HTML - Font with CSS
Uses CSS to define the HTML font.
CSS
- font-size: defines font size as in pixel.
- font-weight:defines weight of the font (value:normal, bold, bolder, lighter)
- width: defines the width as in pixel.
- color: defines text color
- font-style: defines font style (value:normal,italic,oblique)
- font-family: defines the font name to be used.
<style> .header1 { font-size: 18px; font-weight: bold; } .fontbody { font-size: 12px; width:550px; color:blue; font-style: italic; font-family: Gill, Helvetica, sans-serif; } </style>
Usage
Use the class attribute to assign the CSS to the HTML tags.
<p class="css"> something </p>
Example TRY-IT
<!DOCTYPE html> <html> <head> <title>Font</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style> .header1 { font-size: 18px; font-weight: bold; } .fontbody { font-size: 12px; width:550px; color:blue; font-style: italic; font-family: Gill, Helvetica, sans-serif; } </style> </head> <body> <p class="header1">Chapter 1</p> <p class="fontbody"> Cambodia has an area of 181,035 square kilometers (69,898 sq mi) and lies entirely within the tropics, between latitudes 10° and 15°N, and longitudes 102° and 108°E. It borders Thailand to the north and west, Laos to the northeast, and Vietnam to the east and southeast. It has a 443-kilometer (275 mi) coastline along the Gulf of Thailand. </p> <p class="header1">Chapter 2</p> <p class="fontbody"> The tourism industry is the country's second-greatest source of hard currency after the textile industry.[52] Between January and December 2007, visitor arrivals were 2.0 million, an increase of 18.5% over the same period in 2006. Most visitors (51%) arrived through Siem Reap with the remainder (49%) through Phnom Penh and other destinations.[76] Other tourist destinations include Sihanoukville in the south east which has several popular beach resorts and the area around Kampot and Kep including the Bokor Hill Station. Tourism has increased steadily each year in the relatively stable period since the 1993 UNTAC elections; in 1993 there were 118,183 international tourists, and in 2009 there were 2,161,577 international tourists.[77] </p> </body> </html>
Output
Related Link
- HTML - pre
- HTML - Lists
- HTML - Formatting
- HTML - Fonts
- HTML - Block