HTML Notes
.png)
HTML
.png)
HTML Tags and Elements
.png)
Attributes and Hyperlinks
.png)
Headings and Lists
.png)
Class and id attributes
.png)
Semantic Elements
.png)
Inline and Block-Level Elements
.png)
Div and Span
.png)
img
.png)
Tables
.png)
Forms
Heading
Q
1
What is the function of <div> element in HTML?

Ans
This is the very important block level tag which plays a big role in grouping various other HTML tags and applying CSS on group of elements. It acts as a container for other elements.

Q
2
What are the attributes that can be used with div element?

Ans
Although <div> element doesn’t require attributes but there are three common attributes that can be used-
1. Style
2. Class
3. Id
Example-
<!DOCTYPE html>
<html>
<head> <title>HTML div Tag</title> </head>
<body>
<div style = "color: green">
<h1>This is first group</h1>
<p>Following is a list of sports </p>
<ul>
<li>Cricket</li>
<li>Football</li>
<li>Tennis</li>
<li>Boxing</li>
</ul>
</div>
</body>
</html>
Output: This is first group Following is list of sports-
● Cricket
● Football
● Tennis
● Boxing

Q
3
Explain <span> element in HTML.

Ans
The span element is used as a container for text. Like <div>, it does not require attributes. Style, class and id are the commonly used attributes.
The <span> element is used to style a certain text within a larger text element.
Example-
<!DOCTYPE html>
<html>
<head>
<title>HTML span Tag</title>
</head>
<body>
<p>This is my <span style = "color:red">first assignment</span>.I am <span style = "color:purple">learning </span></p> a lot from it.
</body>
</html>
Output: This is my first assignment. I am learning a lot from it.
