The div tag is used in HTML to make divisions of content in the web page like (text, images, header, footer, navigation bar, etc). Below example will display the difference between span and div tag while div tag contains whole width and span tag contain only required width and rest parts are free for another element. See your article appearing on the GeeksforGeeks main page and help other Geeks. It does not affect the content or layout and is used to group HTML elements to be styled with CSS or manipulated with scripts. Negative margins can be applied to both static or floated elements. close, link The div HTML tag is used to group HTML block elements like paragraphs, headings, and format those with style or CSS. By default, if we have multiple div tags it will be displayed one below the other. Writing code in comment? Div tags and span tags are very common HTML elements that are growing in popularity due to their flexibility. To display multiple div tags in the same line, we can use the float property in CSS styles. Inline CSS: The

tag is used for defining a section or a division in an HTML page. The content is written between the opening (
) and closing (
) tags. avoiding of line break, results only that selected text to change, keeping all the other elements around them same. Write Interview CSS float property, or "floats" allows elements to appear next to, or apart from, one another, which lets us create different types of layouts, including multi-column pages, sidebars, grids, etc. The div tag is a non-visual (by default) element that can be used to apply additional properties to content contained within it. Unexplainable DIV space. By using style attribute this style will apply to that particular div. with name color.css which properties of div. As we know Div tag is block-level tag in this example div tag contain entire width. The div tag is very flexible in creating web layouts and easy to modify. Code: Supported Browser: The browser supported by
tag are listed below: If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. Div in HTML coding is used as a container tag also because it is the one that can contain all other tags. we can directly use CSS in div also this method does not require of CLASS. HTML div tag - represents a generic section of an HTML document. The
element should be used only when no other semantic element (such as
or