HTML Styles

The HTML style attribute is used to add styles to html an element such as color, font, size, background color, text align, padding, margin, border, width, height, float etc.

The HTML Style Attribute

There are many property for HTML style as below.

  1. font-family
  2. padding
  3. margin
  4. text-align
  5. color
  6. background
  7. text-align
  8. border
  9.  width
  10. height and more......

Text Color

color property is used to set color of text.

Syntax:

color:#000000;

Background Color

The CSS background-color property is used to set the background color for an HTML element.

Syntax:

background-color:#0066FF;

Text Alignment

The CSS text-align property is used to set the horizontal text alignment for an HTML element.

Syntax:

text-align:center;

Text Font

The CSS font-family property is used to set the font to be used for an HTML element

Syntax:

font-family: Arial, Helvetica, sans-serif;

Example :

<!DOCTYPE html>
<html>
<head>
<title>Learn HTML Styles by aryatechno</title>
</head>
<body>
<table>
<tr>
<td>
<p style="background-color:#9966FF;color:#CC0000;font-family:Arial, Helvetica, sans-serif;font-size:18px;text-align:center;">We provides HTML Styles tutorials to learn it.</p>
</td>
</tr>
</table>
</body>
</html>

Output :

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

94841