HTML Attributes - wordsclank.in

Thursday 1 November 2018

HTML Attributes

Attributes are unique words used to modify or add functionality to an HTML element to meet users requirements. Attributes are written on the opening tag of HTML elements, after the element's name. All attributes consists of two part - a name and a value separated by = sign.

< element attributename =" value " > content here < /element >






Most often used attributes :

Attribute name
Description
Example
id
id attribute is used to uniquely identify any HTML element < p id = "para" > This is a paragraph < /p >
class
class attribute is generally used to associate with a style sheet class = "classname1, classname2"
style
style attribute is used for styling of an element. p style = "font-family:arial; color:green> This is a paragraph /p >
title
title attribute is used for suggestion of a element. Value of title attribute will be shown on mouseover. < h1 title = "titleattribute" > Suggestion will be shown on mouseover < /h1 >
href
href defines a link address. href is used with < a > < a href = "www.wordsclank.in" > wordsclank < /a >
img
img attribute are defined for images < img src = "image.jpg" >
src
src attribute defines the source of the image. < img src = "image.jpg" >
alt
alt attribute is used to show a alternate text. < img src = "image.jpg"  alt = "altrnt_txt" >
width and height
width and height attributes are used to define the size of an element.  < img src = "image.jpg" width="20px" height="20px" >

We will learn a lot of attributes later. These the most often used HTML attributes. 





No comments:

Post a Comment