View Full Version : <hr /> Tag
Girard Ibanez
09-05-2006, 01:17 AM
I understand that one must not use a tag (in this example) <hr /> or <br /> with out defining it.
I am still not clear as to how to define it or if it is defined in the css or htm?
Thanks again,
girard
Tags are defined in the DTD (Document Type Definition) to which you point the parser with the <!DOCTYPE> tag at the beginning of your document. Both <hr> and <br> are defined in all doctypes since HTML 3.2 (except possibly frameset) and probably earlier.
Don't insert XHTML syntax (such as self-closing tags, the <TAGNAME /> construct) into HTML pages. It may have unexpected effects. Also, it's generally a bad idea to serve XHTML to clients (http://www.hixie.ch/advocacy/xhtml).
jscheuer1
09-05-2006, 06:14 AM
I understand that one must not use a tag (in this example) <hr /> or <br /> with out defining it.
I am still not clear as to how to define it or if it is defined in the css or htm?
Thanks again,
girard
What Twey says is correct but, if you are still wondering about it, just go ahead and use the tags. They are perfectly fine 'as is' with the exception that you should not use that self closing slash, use <br> and <hr>, not <br /> and <hr />.
Once you start getting a bit more advanced in your coding you can, if you choose, define style for these or any other elements on your page. A DOCTYPE is always a very, very, good idea but, not absolutely required for the novice. From the designer's perspective, all a DOCTYPE does is tend to make the appearance of the page a little more consistent in the various browsers.
Girard Ibanez
09-05-2006, 05:09 PM
This is the doc type from DW8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
So if I wanted to create a white space, will the <br /> tag be the correct syntax and still be validated by w3c?
I know I am new to code but I have taken all your advice and rewrote my webpage. Great learning process and yes time consuming but well worth learning.
I guess I am trying to understand two tags (br and hr) and proper usage using the above doc type declared.
Thanks again
I repeat, don't serve XHTML to clients (http://www.hixie.ch/advocacy/xhtml).
Girard Ibanez
09-05-2006, 06:52 PM
Which of the two doctype that DW8 offers for new page should I use?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
girard
jscheuer1
09-05-2006, 09:58 PM
Strict is best if you can use it. It is no good for validation with iframes though, and there are probably some other things like that. However, this cannot be stressed enough:
Don't use <br />
Use <br>--------------------------!
[Strict] is no good for validation with iframesAnd frames in general, in fact (the target attribute is also disallowed) for the simple reason that it's recommended not to use them :)
mwinter
09-06-2006, 07:20 PM
So if I wanted to create a white space, will the <br /> ...
On a different subject, that depends what exactly you're expecting the br element to do. It is for breaking lines, not inserting space between elements. For example:
<div class="mailing-address">
221B Baker Street<br>
Westminster<br>
London
</div>
is fine, but:
<p>Some text</p><br><br>
<p>Some more text</p>
is not. In the latter case, CSS should be used to add more space using margins.
Mike
boxxertrumps
09-07-2006, 12:00 AM
Can All empty tags End With "/>" ? (without a </tag>)
For example, a <script scr=Blah.js /> type of situation?
mwinter
09-07-2006, 12:20 AM
Can All empty tags End With "/>" ? (without a </tag>)
You mean empty elements[1]. In applications of XML that will be read by a XML processor, yes. The almost always means no for serving to clients across the Web. MSIE, for example, doesn't use an XML processor, so it will think you didn't close the script element start tag. Very bad.
Mike
[1] Elements are composed of a start-tag, content, and an end-tag. A start-tag may contains attributes. Tags cannot be empty because a tag itself doesn't have content: elements do.
boxxertrumps
09-07-2006, 01:24 AM
My Mistake.
I Will Remember That Tags Arent Elements.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.