bades — 2011-02-06T23:30:14-05:00 — #1
<p class="title_box"><a href="docs/2011.pdf">Custom Packages</a><hr /></p>
I'm getting an error saying: end tag for element "p" which is not open.
I thought I was closing everything in this line correctly?
( <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> )
felgall — 2011-02-06T23:35:32-05:00 — #2
With an HTML 4.01 doctyoe it should be coded:
<p class="title_box"><a href="docs/2011.pdf">Custom Packages</a><hr></p>
The /> for self closing tags are only used in XHTML.
bades — 2011-02-06T23:41:11-05:00 — #3
Oh ok, I thought it was something with the doc type, I'm new to this kind of stuff.
Since I have a lot of self-closing tags in my website, perhaps I should switch to a different doc type?
bades — 2011-02-06T23:42:25-05:00 — #4
XHTML 1.0 Strict?
I want to stay up to date with current doctypes and HTML trends.
black_max — 2011-02-06T23:54:29-05:00 — #5
Bades, in my opinion it's better to remove the self-closing tags and stick with HTML 4.01 Strict. Stephen, since the <hr> tag is a block element, shouldn't it be outside the <p></p> element?
bades — 2011-02-06T23:59:34-05:00 — #6
I decided that XMHTL 1.0 Strict would be best practice top use.
Can't figure out this one though...
Document type does not allow element "hr" here; missing one of "object", "ins", "del", "map", "button" start-tag
…class="title_box"><a href="seminars.html">Training & Seminars</a><hr /></p>
So what am I suppose to do if I want to place an hr here?
bades — 2011-02-07T00:01:36-05:00 — #7
Ah you seemed to answered my last post then.
I'll look into the differences of HTML4.01 and XHTML 1.0, and see which one is better or more widely accepted.
spacephoenix — 2011-02-07T00:04:21-05:00 — #8
Try moving the <hr /> so that it's outside of the </p>
bades — 2011-02-07T00:06:27-05:00 — #9
felgall — 2011-02-07T01:05:35-05:00 — #10
Oops - I spotted the most obvious error in the code and didn't think to check if it was the only one - or the one causing the error message.
Also it has been qute a while since I added a <hr> tag into a page since they are impossible to style consistently across the different browsers so I hadn't needed to think about it being a block tag for quite a long time.
system — 2011-02-07T12:18:47-05:00 — #11
That's why the ONLY time I use HR is for the CSS off or print users to divide up areas -- and then set them to display:none for media="screen,projection,tv" and media="handheld"
I want a divider after a paragraph like that, I pad the bottom, margin the bottom, and use border.
That said, class="titleBox" ?!? Shouldn't that be a numbered heading? (wild guess, I'd have to see the whole section of markup)... as it is that's not enough text to warrant calling it a paragraph.
bades — 2011-02-07T15:27:09-05:00 — #12
I've already used h1, h2, on the page, and I've used h3, on a few other pages(I'm using one CSS page)
So I could use an h4, but I heard after h3, that headings aren't really so useful like for SEO stuff. is this true?
felgall — 2011-02-07T15:34:27-05:00 — #13
If you are thinking about SEO when deciding what tags to use in the page then you are going about it entirely the wrong way.
Use the tags that best describe what their content is. If you define the page with the semantically correct tags then both real people and search engines will be able to understand it better and less SEO will be required.
system — 2011-02-07T16:37:32-05:00 — #14
Felgall hit the bullet points -- in particular the "if you are using a tag JUST for SEO you're probably using it wrong" -- but your wording on "I've already used" makes me ask "are you using them correctly?"
The POINT of heading tags is to say in each section what's a subsection of what -- H3 is the start of a subsection of the h2 preceeding it, H2 is the start of a subsection of the h1 preceeding it, and you should only ever have one h1.
I'd have to see the whole page to say for sure, but so far your wording is sending up warning flags with me.
But I get that way whenever I see things like <p class="title"> or <td class="heading"> -- it's usually an indication someone hasn't grasped how semantics work yet or have giant gaps in their understanding of HTML.
bades — 2011-02-07T16:47:55-05:00 — #15
My h1's and h2's are formatted the same throughout the website on each webpage.
I'm also only using one CSS page for the entire website, so when I establish style for the h1 on the home page, the h1 on the products page is going to be the same.
Can you apply id's and classes to headings?
This is completely true, I'm a beginner only been doing this for about 6 months, and everything new site, and every new page has something where I learn more and more about HTML/CSS.
I would say it's almost impossible to learn everything there is about HTML before you start playing around with it, an dI'm learning as I go along.
Also are you guys stating that any time you have a header/title of section of text or whatever it should most likely be within a <h> tag?
system — 2011-02-07T17:41:32-05:00 — #16
For the most part -- yes... either a numbered heading, or the appropriate heading-type tag for the element.
Numbered headings are NOT the only heading type elements in HTML. You have CAPTION which is basically a heading for a table, you have TH which is a heading for a row or column (typically for the column if in THEAD, or for the row if in TBODY -- assuming you use those structural/semantic elements PROPERLY, which of course few people do). You have LEGEND which is the title for a FIELDSET, a grouping of form INPUTS, you have LABEL which is a heading for a form input element like INPUT, TEXTAREA, SELECT, etc.
Oh, and about H1 -- since there should only one of these per page ANY other heading-type element you use on the page is basically saying it's a subsection of THAT... this is why IMHO it should be the first semantic element on the page since by definition EVERYTHING is a subsection of it... and so on and so forth down the list. You make a new heading, the content under that heading should be a subsection of the heading preceding it, with the headings fanning out like a tree.
Basically we're talking semantic markup -- saying what things ARE and NOT how they are going to appear; which also entails NOT using tags with meanings around the wrong elements... two or three words of text is not a GRAMMATICAL paragraph, and if you are thinking a typographical paragraph you are thinking APPEARANCE, which has NO BUSINESS in your HTML. Just because it's text doesn't mean it gets a P around it... and if it's not text, it most certainly should not have a P around it. You see people make that mistake with IMG all the time... only time it would be appropriate to be around IMG would be if said image is inline to the text like a smily
black_max — 2011-02-07T18:25:02-05:00 — #17
Stephen, there are some wonderfully Byzantine code snippets out there for styling HR elements so they display the same cross-browser. Generally, they're more trouble than they're worth, I think.