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.
We will learn a lot of attributes later. These the most often used HTML attributes.
< element attributename =" value " > content here < /element >
Most often used attributes :
Attribute name | ||
id attribute is used to uniquely identify any HTML element | < p id = "para" > This is a paragraph < /p > | |
class attribute is generally used to associate with a style sheet | class = "classname1, classname2" | |
style attribute is used for styling of an element. | < p style = "font-family:arial; color:green" > This is a paragraph < /p > | |
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 defines a link address. href is used with < a > | < a href = "www.wordsclank.in" > wordsclank < /a > | |
img attribute are defined for images | < img src = "image.jpg" > | |
src attribute defines the source of the image. | < img src = "image.jpg" > | |
alt attribute is used to show a alternate text. | < img src = "image.jpg" alt = "altrnt_txt" > | |
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