Forum Moderators: open

Message Too Old, No Replies

<hr> and <h3> tags

<hr> affecting next <h3> tag

         

Birdman

12:56 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello all at WW. This one is probably simple, but here goes.
[qoute]<hr style="color: FF69B4;">

<h3><a href="headpieces.html">Headpieces</a></h3><br>[/quote]
Using the Netmechanic tool, I am trying to fix errors and hopefully validate. Previously, I had a </hr>. When I removed it, the <h3> was affected.(i.e. no underline and same color as <hr>) It worked fine before I changed it, at least on my browser. Thanx for any help in advance.

Birdman

1:12 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't how winky got in there. That's weird.

Nick_W

1:17 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So what's the question Birdman?

Nick

Birdman

1:27 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Should I ignore the validator and put the </hr> tag back, or is there another way to correct.

Thanx Nick

rcjordan

2:12 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try <hr style="colorhere;" />

papabaer

2:35 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Birdman,
A little "syntax" tweaking is all that's needed. While the horizontal rule element is considered an "open element," not requiring a closing tag (</hr>) XHTML requires ALL tags be closed. This is handled by by adding a space followed by a "/" backslash to the solitary tag: <hr />. Older versions of HTML do not require this for validation, but the latest version of HTML (XHTML), does. The following is valid code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HR - H3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<hr style="background:#FF69B4;" />

<h3><a href="headpieces.html">Headpieces</a></h3>
</body>
</html>

Technically, you want to apply a "background-color" to your <hr /> not the "foreground" property, color:

(edited by: papabaer at 2:47 pm (utc) on May 25, 2002)

Birdman

2:46 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks rcjordan and papabaer. I've been trying <hr style="colorhere;" />
to no avail. I just noticed the space before backslash. Maybe that's it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

Papabaer, did you look at the page in question. If so, is this the DTD(I think that's what it's called) I should use?

Nick_W

2:57 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That dtd looks ok to me though if you're going to use strict why not go the full whack and use xhtml 1.1?

<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Sorry I never came back to help I got sidetracked on a little project and have only moved from it to fetch beer ;-)

Nick

papabaer

3:04 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to change <hr style="color: FF69B4" /> to <hr style="background:#ff69b4" />

Using a <!doctype> is the first step in writing validating code. You can find a great tutorial on XHTML (HTML formatted as XML) at W3Schools: [w3schools.com...]

It is not much different than HTML at all, just more formal. It is very easy to learn and the advantages are validating code that can be read across browsers and devices.

You might also wish to move your "inline-style" to the head content:
<sytle type="text/css">
hr {
background:#ff69b4;
}
</style>

Here you have greater control, better still, create your CSS and move them to your external stylesheet.

Best of luck! - papapbaer

Birdman

3:12 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No prob, Nick. I don't know if I want to use strict or not. I am a newbie coder(about three months since I started at HTMLgoodies).
fetch beer ;-)

Man, it's still morning on the east coast of U.S. What time is it there? That beer sounds good though! :)

Birdman

3:20 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you papabaer. I'm off to that link. I love learning new stuff. Especially here! I'm hooked on this site! XHTML it is. <Birdman gives his call>

Nick_W

3:21 pm on May 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



5pm, definately time for beer!

If you've only been coding a few months then learn good habits by coding and validating at [validator.w3.org ] and use the xhtml 1.1 or strict dtd's it'll stand you in good stead for the future and as Papabear said, it's actually rather easy.

Nick

Birdman

2:50 am on May 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wow, this XHTML conversion is tough! It seems like every other page has error(s). I guess it'll be worth it in the long run. Working on page one still, 250 or so left :(

papabaer

2:58 am on May 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheer up Birdman! It will DEFINATELY be worth it when you are finished. Plus, you will have pages that will display not only across browsers, but across devices.

Did I mention the "warm and fuzzy" feeling after your first XHTML page validates? ;)

Best of luck!

Birdman

6:47 am on May 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"warm and fuzzy"

I'm looking forward to that! Thanks for the moral support papabaer. I sure wish I would have started straight out with the new stuff. IOW I wish I knew about WW. Mabye when I have 300 or so posts, I might actually answer a question for someone. It seems I need to focus on xml to learn the coding. Woould that be a correct assumption?
<added>Thank you to all the great people who make WW the best forum of it's kind</added>
:)

Birdman

6:50 am on May 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>It seems like every other page has error(s).

I meant every other line!