HTML Styles

#1
Lightbulb 
HTML Styles

Example
I am Red
I am Blue
I am Big


The HTML Style Attribute
Setting the style of an HTML element, can be done with the 

style
[size=undefined]
 attribute.[/size]

The HTML 

style
[size=undefined]
 attribute has the following syntax:[/size]

<tagname style="property:value;">
The property is a CSS property. The value is a CSS value.
You will learn more about CSS later in this tutorial.

HTML Background Color
The 

background-color
[size=undefined]
 property defines the background color for an HTML element.[/size]

This example sets the background color for a page to powderblue:
Example
<body style="background-color:powderblue;">

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>





HTML Text Color
The 

color
[size=undefined]
 property defines the text color for an HTML element:[/size]

Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

HTML Fonts
The 

font-family
[size=undefined]
 property defines the font to be used for an HTML element:[/size]

Example
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>



HTML Text Size
The 

font-size
[size=undefined]
 property defines the text size for an HTML element:[/size]

Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>



HTML Text Alignment
The 

text-align
[size=undefined]
 property defines the horizontal text alignment for an HTML element:[/size]

Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>



Chapter Summary
  • Use the 

  • style

  • [size=undefined]
     attribute for styling HTML elements[/size]

  • [size=undefined]Use [/size]
  • background-color


  • [size=undefined]
     for background color[/size]

  • [size=undefined]Use [/size]
  • color



  • [size=undefined]
     for text colors[/size]

  • [size=undefined]Use [/size]
  • font-family




  • [size=undefined]
     for text fonts[/size]

  • [size=undefined]Use [/size]
  • font-size





  • [size=undefined]
     for text sizes[/size]

  • [size=undefined]Use [/size]
  • text-align






  • [size=undefined]
     for text alignment[/size]

Reply




Users browsing this thread:
1 Guest(s)