Jump to content

Br Tag


rainwater

Recommended Posts

I bought two of the books recommended to me by 23.12.2012, and am going through them beginning with HTML. In the tutorials on the w3schools site, it said the <br> element is deprecated. Did I get that word correct this time?In the book, it uses the <br> tag. Should I just change it to the <br /> tag?

Link to comment
Share on other sites

More generally, in SGML (which HTML is based on), empty tags (e.g. started and closed in one tag with no body) don't have the extra trailing slash, but in XML (which XHTML is based on) empty tags must be indicated by a slash at the end of the tag.It is invalid to use XML-style empty tags like <br /> when writing HTML.

Link to comment
Share on other sites

So, Let me see ... in my old website which was based on HTML back in 2000, it used the <br> tag, and because it is not XHTML, I should leave it until the whole website is updated???

Link to comment
Share on other sites

:) Sorry, I guess I did not ask my question right.On my old website made back in 2000 with all the old HTML, not XHTML or any CSS, just basic HTML using code to do everything in HTML. Because it was based on HTML, I should not use the <br /> tag until the whole site is upgraded to at least XHTML? If you want to look at the source of that antique it is: mainemadestuff.comBecause Synook said It is invalid to use XML-style empty tags like <br /> when writing HTML.My question is above....Should I not use the <br/> tag until the whole site is upgraded to XHTML and CSS? :)
Link to comment
Share on other sites

The answer remains the same as what Deirdre's Dad said.As soon as you change the DTD of a single page from HTML to an XHTML one (or simply add an XHTML DTD, as in your case), you must use <br /> on that page to make it a valid XHTML. You don't have to add the DTD on every page of the site to use <br />. You can Add it to the homepage, and use <br /> on the home page, while still keeping the rest of the pages with HTML and using <br>.BTW, note that without a DTD, all of your old pages are currently invalid.

Link to comment
Share on other sites

You don't have to change your website to use XHTML (and it won't necessarily be "upgrading" it either) - HTML 5 will be just as modern as XHTML 5.

Link to comment
Share on other sites

Questions.1. So, am I learning this XHTML for nothing since HTML5 is coming out?2. I thought my website mainemadestuff.com is not being picked up by the search engines because it is so invalid, being made with pre 2000 HTML. Is this correct?3. Instead of changing my website now, should I wait for the HTML5 and then fix it up? Synook said: You don't have to change your website to use XHTML (and it won't necessarily be "upgrading" it either) - HTML 5 will be just as modern as XHTML 5.4. Or, should I try to change the index page to XHTML with a DTD and leave the other pages as is?Gosh, I wish you all were right here to ask these questions to. It takes some kind of sledge hammer to get this into my head.

Link to comment
Share on other sites

I personally operate with the assumption that XHTML will be history. Some companies standardize on it, so you need to accomnodate them, but my own stuff is all HTML. Where the major browsers have adopted HTML5 features, I use them. I do not use attributes that are legal in HTML 4 but deprecated in 5. I use lowercase for everything. The major differences between that and XHTML pretty much come down to the doctype and the self-closing tags. So if I ever need to make the switch, I can.But I don't expect to. The W3C changed direction midstream. It's just that simple.I really doubt SEO problems are related to using no doctype or invalid code. More likely, it's just not optimized. Like, your h1 and h2 elements need to contain keywords that identify your stuff. If your keywords appear "naked" in td elements, then a SE has no way of knowing that it's supposed to be important, even if the font size is huge. And if your h1 element (you should have exactly one) is wasted on words that don't do anything important, then you've wasted a valuable resource.Don't wait for HTML 5. Browsers already implement a lot of HTML 5. By the time the standard becomes an official recommendation, most of it will already be implemented. So there really won't be a "debut" day when everyone switches. The browsers will simply begin to recognize a DTD on that day. But the elements will be in place.The most important reason to upgrade to a strict doctype of HTML or XHTML is to make sure all browsers render your elements consistently. There are short summaries of that here and here.You may certainly upgrade your pages one at a time, as you get the time. Your only concern might be if you have a recurring structure, like a banner or menu, that must appear exactly the same in all your pages. Having a different doctype in some of the documents might mean that such a structure might look a little different.

Link to comment
Share on other sites

The most important reason to upgrade to a strict doctype of HTML or XHTML is to make sure all browsers render your elements consistently. There are short summaries of that here and here.
Correction - parse. All browsers will parse your elements consistently. Parsing is the first step of rendering, and therefore, the most important to get right, but that's not all there is to rendering. Therefore, do not go validate your code with the assumption it will work consistently across all browsers from then on. You will still have problems, most of which will be due to IE bugs. Making your page valid will help though, as parsing inconsistencies will be excluded from the possible causes.
1. So, am I learning this XHTML for nothing since HTML5 is coming out?
I wouldn't say that. Worst case scenario is that XHTML will only teach you some discipline, which you're not likely to get with HTML5, seeing how it is currently being advertised as.If you want to know more than just (X)HTML and CSS, knowing XHTML will likely help you to more easily understand XML, DOM and other generic web stuff.
Link to comment
Share on other sites

Not so much a correction as a difference of emphasis. I was thinking specifically of the boxmodel problem, which is not an issue of parsing. Perhaps I misspoke when I said "most important." I should have said something like "most important from a design perspective" -- or maybe, "the box-model implementation is the most noticeable rendering difference . . ."

Link to comment
Share on other sites

Thank you so very much...that was a nicely weighted sledgehammer you folks used.That cleared it up a whole lot better for me. As far as wanting to learn XHTML instead of HTML, I was under the impression I had to do that. Now, I know that I do not HAVE to do that, but it is a good idea so to get me organized and learn. I will go through the books and tutorials learning all I can and get ready for HTML5. BTW, when is that supposed to come out?I will update my pages, as much as i can, when I am finished with the books and tutorials. I may just make a whole new site instead of updating my current one. However, like I said way back in the beginning, I really like the look of folder tabs at the top, it is kind of antique-ish, and I like it. Right now, it is all in tables, so do not, yet, know how to transform that. I may change my mind though. I'm sure to be back with more questions. Thanks again for all the good input and clarification. :)

Link to comment
Share on other sites

Great site, thanks. Just what I needed to read.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...