What is HTML Attributes

  • HTML elements can have attributes
  • Attributes provide additional information about an element
  • Attributes are always specified in the start tag
  • Attributes come in name/value pairs like: name=”value”
Attribute Name Description
bgcolor Background Color of the document
background Background Image of the document
align Align left, right, center
size Declare size of font
bottom margin Margin from bottom
top margin Margin from top
class Specifies a classname for an element
id Specifies a unique id for an element
style CSS attribute for tags(Specifies an inline style for an element)
title Specifies extra information about an element (displayed as a tool tip)

Bgcolor ( deleted in html5)

Used to give background color to body tag and table tag,

(How to create a Bgcolor)







(How the HTML code above looks in a browser)

Background ( deleted in html5)

Used to give background image in html4.

(How to create a Background)







(How the HTML code above looks in a browser)



Alignment ( deleted in html5)

Align Attribute is used to horizontally align Text or tables.

(How to create a Alignment)

TEXT Aligned Left

TEXT Aligned Center

TEXT Aligned Right

(How the HTML code above looks in a browser)

TEXT Aligned Left

TEXT Aligned Center

TEXT Aligned Right

Size ( deleted in html5)

size Attribute is used to define size of images, tables, iframes, video, marquee .

(How to create a Alignment)

	
 Font with size 2
 Font with size 5
 Font with size 7

(How the HTML code above looks in a browser)

Font with size 2
Font with size 5
Font with size 7

Class

Class is used too define a group of elements having same properties.

(How to create a Alignment)


		

Font with class red

Font with class red

Font without class red

(How the HTML code above looks in a browser)

Font with class red

Font with class red

Font with class red

ID

Id is used to call a unique element. On a single webpage, an id can’t be repeated twice.

(How to create a Alignment)


		

Font with class red

Font with class red

Font without class red

(How the HTML code above looks in a browser)

Font with class red

Font with class red

Font with class red