Jump to content

What exactly is <div> </div>?


optimisten

Recommended Posts

The abbreviation means "division". The difference is that a devision doesn't imply any characteristics of the content inside it. A "paragraph" inherently means "a sequence of related sentences", whereas a "division" means only "something that is somehow different from everything else around".You should use "div" every time you need to group things together, and there is no more appropriate element for it (i.e. paragraphs should still remain paragraphs, lists should remain lists, etc.).On a related note, the "span" element is to be used when a part of text (within a paragraph or whatever) needs to be separated from the rest of the text around it for whatever reason. Elements like "em" and "strong" imply that this part of the text is to be emphasized or said "strong"-ly, while "span" doesn't imply a particular kind of treatment, while still specifying isolation.

Link to comment
Share on other sites

A div has no default style information. It is a block-level element, meaning that it claims the full width of the page unless you style it otherwise, and any elements coming after it will be placed below it, unless you style it otherwise. Divs are good for containing large section. Ideally, a p element will only hold text (and maybe small, icon-like images).

Link to comment
Share on other sites

http://www.w3schools.com/tags/tag_div.aspIt's a semantic tag for grouping a page into divisions, like header, navigation, content, footer, etc. A <p> is the same (block level element) but semantically it is meant for blocks of text. In HTML5, they will have content specific div tags, like <header>, <nav>, <footer>, etc.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...