I am trying to get my head around DIV code tags and want to ask a simple ish question. If I open a div statement and then open another div statement, how does the page know which closing tag is for which statement, or does it not matter?
"div" is not a statement (if you referring a programing term), it's an element/ tag. Every html tag which is opened needs to have a closing tag as well. for example: <div>your content</div> Code (markup):
just a sample <div id="header"><!--this for open header--> some statements here <div id="menu"><!--this for open menu--> some statements here </div><!--this for close menu--> </div><!--this for close header--> PHP:
No one said anything about PHP... @OP in html when you close a tag is closes the most recently opened one. Simples.
All tags have an opening and closing tag i.e. Open div tag <div> closing div tag </div> open paragraph tag <p> closing paragraph tag </P> Closing tag always has the "/" at the beginning. The "/" means it's the closing tag. A div tag is a container. Something you can put other stuff in like paragraphs or images or even other div tags etc. div tags can be nested i.e. you can put div tags inside other div tags. When you nest tags they are ordered from the middle out or if you prefer visa versa. i.e. <div> /*Opening parent tag */ <div> /* Opening child tag */ </div> /* Closing child tag */ </div> /* Closing parent tag */ Code (markup): Some tags like image tags "img" are self closing i.e. <img src="myImage.jpg" /> The closing "/" is included at the end of the tag. the break tag is another such tag; <br />
Make sure you use proper nesting. ronc0011 has a good example. Picture your div like a box. Your second box has to be completely inside the first. This is the same with any HTML tag.