Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

What is the <div> tag in HTML?

Hammad Nasir

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The <div> tag in HTML

The <div> tag is used as a container for other tags in an HTML page. The <div> tag can contain any element, and almost all browsers add line breaks before and after the <div> tag. The structure of the <div> tag is as follows:

<div>Text or Tags here</div>

Example usage of the <div> tag

The following code provides an example:

In the example above, 2 <div> tags are used, where the first one has class divA and the second one has class divB. These classes are defined in the CSS tab which results in the styling of the div. The <div> tag can contain any number of tags (even <div> tags as well).

Browser Support

Browser Support
Chrome Yes
Firefox Yes
Safari Yes
Edge Yes
Opera Yes

RELATED TAGS

html

CONTRIBUTOR

Hammad Nasir
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring