top of page

HTML Notes

mobiprep (6).png

HTML

mobiprep (6).png

HTML Tags and Elements

mobiprep (6).png

Attributes and Hyperlinks

mobiprep (6).png

Headings and Lists

mobiprep (6).png

Class and id attributes

mobiprep (6).png

Semantic Elements

mobiprep (6).png

Inline and Block-Level Elements

mobiprep (6).png

Div and Span

mobiprep (6).png

img

mobiprep (6).png

Tables

mobiprep (6).png

Forms

Heading

Q

1

What is the function of <div> element in HTML?

LRM_EXPORT_207556595493866_20190724_1939

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.

LRM_EXPORT_207556595493866_20190724_1939

Q

2

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

LRM_EXPORT_207556595493866_20190724_1939

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

LRM_EXPORT_207556595493866_20190724_1939

Q

3

Explain <span> element in HTML.

LRM_EXPORT_207556595493866_20190724_1939

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.

LRM_EXPORT_207556595493866_20190724_1939
bottom of page