HTML Attributes
HTML Attributes
HTML Attributes :-
They provide additional information
about the HTML element.
~ Has to be specified in start tag.
~ Comes as name/value pairs like:
name= “value”
Example:-
Src attribute :-
Used with <img> (no end
tag) element, src specifies
the path where the image
to be shown is placed.
Example-
Width and height attributes :-
Used with <img> element, width defines
the width and height defines the height of
the image.
Example:-
Alt attribute :-
Used with <img>, alt defines alternate text for image if it
fails to load due to some error.
Example:-
Style attribute :-
Can be used in any tag to style
it.
Example-
Title attribute :-
Can be used in any element, it
gives some extra information about a
element.
The value of this attribute will be
displayed as a tooltip when you mouse
over the element.
Example-
Lang attribute :-
Used in <html> </html>
element. Lang declares the
language of Web page. This is
meant to assist search engines
and browsers.
Example-