Powered by Blogger.
RSS

HTML Attributes

HTML tags can contain one or more attributes. Attributes are added to a tag to provide the browser with more information about how the tag should appear or behave. Attributes consist of a name and a value separated by an equals (=) sign.


  1. HTML elements can have attributes
  2. Attributes provide additional information about an element 
  3. Attributes are always specified in the start tag
  4. Attributes come in name/value pairs like: name="value"
 Try It Yourself

<p style="background-color:orange;">Do you like my background color?</p>

<a href="http://www.jesmansblog.net">This is a link</a>

  • This particular attribute statement, style="background-color:orange", tells the browser to style the <p> element with a background color of orange.
  • HTML links are defined with the <a> tag. The link address is specified in the href attribute
 Note
  1.  Attribute values should always be enclosed in quotes. 
  2.  Double style quotes are the most common, but single style quotes are also allowed.
  3.  Attribute names and attribute values are case-insensitive.
Summary
Many attributes are available to HTML elements, some are common across most tags, others can only be used on certain tags.
Below is a list of some attributes that can be used on any HTML element:

class ==> Specifies one or more classnames for an element (refers to a class in a style sheet)

id ==> Specifies a unique id for an element

style ==> Specifies an inline CSS style for an element

title ==> Specifies extra information about an element (displayed as a tool tip)

 <<Add More To Your Basic HTML Page #2
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

1 comments:

Vick Sa said...

HTML Tutorial with Examples - Attribute

HTML Attributes are property of the elements which may have values and these attribute values are always enclosed in quotes. It’s providing to the browser with some additional information about an elements how the elements should appear or behave. HTML elements can contain one or more attributes, attribute names and attribute values are case-insensitive and separated by an equals (=) sign.

http://www.willvick.com/HTMLTutorialwithExamples.aspx
http://www.willvick.com/HTMLTutorialwithExamples/Attribute.aspx
http://www.willvick.com/HTMLTutorialwithExamples/ExamplesAttribute.aspx

Post a Comment