Attributes in HTML5 are explained bellow as
Let’s go back to adding an image with the empty img element. Obviously, as we Know that an
<img>
tag is not very useful by itself—there’s no way to know which image to
use.Therefore we use attributes in the tags for our understanding and browsers understanding.
All the Attributes are instructions which are used to clarify
or modify an element. For the img element, the src (short for “source”) attribute
is required, and also used to specifies the location (URL) of the image file.
Syntax of Attribute
attributeName ="
value "
All the Attributes usually go after the element name, separated by a space. In non-empty elements, attributes go in the opening tag only
<
element
attributeName
="
value
"
>
Content <
/element
>
Example of attribute
<
p
style
="
background: grey; color: white; padding: 5px;
"
>
Background color is grey<
/p
>
Output of above code
Background color is grey
Multiple attributes
More than one attribute in an element can be inserted. Just keep them separated with spaces.
Demo
Example of multiple attributes
<
img
src
="
img/bg-img/gallery1.jpg
"
width
="
200px
"
height
="
200px
"
>
Output of above code

Comment here
If you have any query, if you want to know something about any of technical course related to computer science field, if you have any suggestion about relevant to uploaded content or if you anything wrong here (any mistake in content) than please contact us. Keep in mind, comment should be according to community guidelines.