HTML attribute defines the characterstics of any HTML element. These attributes provide additional information to the browser about the element like, its size, color, behaviour, etc.
'src'
in <img>
tag OR 'href'
in <a>
tag,etc..The 'lang'
attribute is declared in the opening <HTML>
tag.
It gives information to the browser about the main language used in the html document. Although it is not necessary to use but using it is a good practice.
lang
attribute for different languages from here.
This page is using English Language.
The Title
attribute is used to specify a tooltip. That tooltip could be some important piece of information in text form. It is often displayed when cursor comes over the element or while the element is loading.
Adding tooltips using Title
attribute, is a smart way to give brief explanations about some element on the webpage. Look at the example below, to see how you can use it with any HTML tag.
WHO was founded in 1948.
CodeRepublics.com
The src
or (source) attribute is used with <img>
tag. This attribute allows us to provide the path for the image to be included on the webpage. it is also used with <audio>
tag, <video>
tag, <embed>
tag, etc. to add the source path of the file to be included.
The alt
attribute specifies an alternative text for an image. If somehow the browser is not able to display an image, then the alternate text will be displayed, which will give the information about the image. Also, value of alt
attribute can be read by screen readers, which helps visually impaired person to "hear" information about the image.
If a browser cannot find an image, it will display the value of the alt attribute :
The style
attribute is used to specify the inline style of an element, i.e., it defines the CSS styling of element like color, font, size, shadow etc.
Follow Us: