![]() |
|
XHTML Tag Closing Rule, Learn XHTML online for free, Free online Extensible HyperText Markup Language Tutorial... |
| Lessons | XHTML Tag Closing Rule |
|
||||||||
|
<p>This is a paragraph. <p>This is another paragraph. The above code is invalid in XHTML. XHTML tag / element closing rule forces us to properly close our ALL tags. So, the correct version of the above code is as under: <p>This is a paragraph.</p> <p>This is another paragraph.</p> You might be thinking about the EMPTY html tags (tags that have no matching closing tags e.g. <img>, <br>, etc). XHTML rules tell us to put a forward slash "/" just before puting ">" to mark the close of an HTML tag. To understand it clearly just consider the following HTML code example: Line Break Tag: <br> Image Tag: <img src="image.gif"> Horizontal Rule Tag: <hr> Input Tag: <input type="text" name="txt"> The above code is not valid XHTML. A valid XHTML version of the above code is as under: Line Break Tag: <br /> Image Tag: <img src="image.gif" /> Horizontal Rule Tag: <hr /> Input Tag: <input type="text" name="txt" />
Next >>> Lesson No. 5: XHTML Tag and Attribute Rules
|