HTML Attributes

in the html language Most HTML tags support one or more attributes.These attributes are included in the opening tag using a standard format

              <tag_Name  attribute_name = "attribute_value">

example "style attribute with the div element":

       <div  style = "border:1px solid #efefef;width:120px;height:120px;"></div>

Some quick point about HTML Attributes:

  • HTML attribute can have attributes
  • The attribute value need to come immediately after the equal sign.
  • The attribute value must enclosed in quotes,either single or double ""
  • The attribute come in name/value pairs like:name=value
  • Attribute values should always be enclosed in quotes. either single or double quotes
  • Attribute names and attribute values are case-insensitive,( Not with XHTML)
  • XHTML requried lowercase attributes
  • Attributes are always specified in the start tag

Attributes Examples

         .class_top{ color:#3a4b9c;  }
         .id_top{ color:red ; }       
     <div class ="_name_of_css_define_class"  id="_name_css_define_id">  </div>
  <link type="indicate relation with href document"  
                    href = "indicate absolute_or_relative path"/>
            <!-- link have not  close tag -->
 <html dir = ""  lang ="language value en-US en-UK">  
                                complete  html document part </html>

some html language Common Attributes which you can use any time when you design web page

A complete list of legal attributes for each HTML element look here : HTML Tag Reference.Below is a list of some common attributes that can be used on any HTML element:its common attributes for tags

AttributeAttribute valueDescription
idcss_defined_id_NameUnique id for each element
classcss_defined_class_nameOne or more classname for an html element
styleadd inline cssSpecifies inline css style for an element
titletext value Some bit extra information for an element