DIV HTML TAG - description ,attributes,css
Divs are tags that can help give your page a logical structure and some extra hooks to apply any CSS or DOM scripting that you might need later. When
used badly, they can litter your document unnecessarily and make your markup, styling, and scripting needlessly complicated.
A div ( short for “division”) is used for marking out a block of content, such as the main content block of your document, the main navigation, the header, or the footer. As such,it is a block element. It can contain further elements, including more divs if required, but it cannot be contained within an inline element.
Requirements
Start tag < : required, End tag: > required
Attributes for div tag :
1. Optional Attributes :
align ( alignment ) left, right, center, justify eg: <div align="left"> ...div content </div>
2. Standard Attributes :
id, class (document-wide identifiers)
lang (language information), dir (text direction)
title (element title)
style (inline style information)
xml:lang
3. Event Attributes :
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)
Tips !
The div element is very often used with CSS to layout a web page. Browsers usually place a line break before and after the div element.
Example :
hi ! These is a center align div !
Code :
<div style="text-align: center">hi ! These is a center align div !</div>
or
<div align="center">Hi ! These is a center align div !</div>