What is DIV in HTML?

Questions by StephenRaj   answers by StephenRaj

Showing Answers 1 - 15 of 15 Answers

varun

  • Apr 2nd, 2007
 

DIV IS SAME AS SPAN BUT IT HAS AN ADDITIONAL PROPERTY OF ALIGN IN IT WITH THE HELP OF WHICH WE CAN ALIGN THE TEXT WITHIN IT,FURTHER IF WE WANT TO PLACE OUR CODE ANYWHERE IN OUR PAGE WE USE DIV TAG AND OUR CODE WITHIN IT.

  Was this answer useful?  Yes

Description of the DIV Tag:

The <div> tag in XHTML is a tag that defines logical divisions within the content of a page. What this means is that a <div> tag defines sections of a Web page to make it easier to manage, style, and manipulate. You can use the <div> tag when you want to center a block of content or position a content block on the page. The <div> tag is a very powerful tool for Web developers.

HTML Definition of the DIV Tag:

In order to use the <div> tag you need to know the HTML definition of the <div> tag. Some key tips:

  • The <div> tag is a block-level element
  • The <div> tag can contain nearly any other tag
  • The <div> tag cannot be inside <p> tags
Tips for Using the DIV Tag:
  • The <div> tag is not a replacement <p> tag. The <p> tag is for paragraphs, only, while the <div> tag defines more general divisions within a document. Don't replace <p> tags with <div> tags.
  • It's a good idea to label your <div> tags as you place them in your document. For example, if you're defining the main content area of your site, you should name that DIV tag: "maincontent". <div id="maincontent">
  • It's always a good idea to close your <div> tags as soon as you open them. Then place the contents within the element.
  • If you nest your <div> tags, be sure that you know where your content is going (in other words, which DIV it should be part of).

<div> tag used to group the elements in the web page as blocks.and we can appply styles to the <div>tag.<div>tag is the best suitable one for design layouts for the web page.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions