top of page

Div and Span: HTML Class Notes

Updated: Oct 18, 2022

Mobiprep has created last-minute notes for all topics of HTML to help you with the revision of concepts for your university examinations. So let’s get started with the lecture notes on HTML.

Our team has curated a list of the most important questions asked in universities such as DU, DTU, VIT, SRM, IP, Pune University, Manipal University, and many more. The questions are created from the previous year's question papers of colleges and universities.

Div and Span

Question- 1) What is the function of <div> element in HTML?

Answer: 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.


Question- 2) What are the attributes that can be used with div element?

Answer: Although <div> element doesn’t require attributes but there are three common attributes that can be used-

  1. Style

  2. Class

  3. ID


<!DOCTYPE html>
<head> <title>HTML div Tag</title> </head>
<div style = "color: green">
<h1>This is first group</h1>
<p>Following is a list of sports </p>


This is first group Following is list of sports-

● Cricket

● Football

● Tennis

● Boxing


Question- 3) Explain <span> element in HTML.

Answer: 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.


<!DOCTYPE html>
<title>HTML span Tag</title>
<p>This is my <span style = "color:red">first assignment</span>.I am <span style = "color:purple">learning </span></p> a lot from it.


This is my first assignment. I am learning a lot from it.


32 views0 comments

Recent Posts

See All


Commenting has been turned off.
bottom of page