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-
<!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>
This is first group Following is list of sports-
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> <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>
This is my first assignment. I am learning a lot from it.