Why don't these 3 lines validate? (XHTML)

  • Tojiro
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 10 Jan 2006
  • Posts: 9
  • Status: Offline

Post May 10th, 2008, 2:22 pm

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9.  
  10. <a href="#"><h6>Heading</h6></a>
  11. <a href="#"><img src="#" alt="Front view" width="72" height="72" /></a>
  12. <p>Lorem ipsum dolor sit amet...</p>
  13.  
  14. </body>
  15. </html>
  16.  


I'm entirely self-taught, so there's likely some rule I've never learned before, but it's really bugging me!

Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 10th, 2008, 2:22 pm

  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Joined: 29 May 2005
  • Posts: 1323
  • Loc: 55° N, 3° W
  • Status: Offline

Post May 10th, 2008, 2:55 pm

Just put the links inside the heading:

  1. <h6><a href="#">Heading</a></h6>


and all shoud be fine.
  • Bogey
  • Ounce of 'Zu'
  • Web Master
  • User avatar
  • Joined: 14 Jul 2005
  • Posts: 4671
  • Loc: Ozzu
  • Status: Offline

Post May 10th, 2008, 8:19 pm

Zwirko wrote:
Just put the links inside the heading:

  1. <h6><a href="#">Heading</a></h6>


and all shoud be fine.

Yeah, a heading tag is a parent tag and a link could be as a child.

Same way that it works with <div>'s and <span>'s. A <span> is a child tag (Means it can go between <div>...</div> or <p>...</p> and some other tags) but a <div> is a parent tag (Means it can't go between anything... <p><div>...</div></p> won't validate).

That's the simple rule your missing... parent tags versus child tags. You gotta know what is what :) (I'm self-taught too by the way... was learning myself for about 3.5 years now :D )
My Developing Blog (7)
Wedevoy.com - In Development... should be done in about a week or so
  • spork
  • Born
  • Silver Member
  • User avatar
  • Joined: 22 Sep 2003
  • Posts: 3828
  • Loc: Rochester, NY
  • Status: Offline

Post May 10th, 2008, 9:56 pm

That's not exactly the case, Bogey.

<div> elements are generic block elements by default.
<span> elements are generic inline elements by default.

That's the difference between the two. It doesn't really have to do with the parent/child relationship.
  • JISForums
  • Born
  • Born
  • No Avatar
  • Joined: 11 May 2008
  • Posts: 4
  • Status: Offline

Post May 11th, 2008, 5:15 am

Didya put the links on <a href=Websiteaddresshere></a>
  • Bogey
  • Ounce of 'Zu'
  • Web Master
  • User avatar
  • Joined: 14 Jul 2005
  • Posts: 4671
  • Loc: Ozzu
  • Status: Offline

Post May 11th, 2008, 3:14 pm

spork wrote:
That's not exactly the case, Bogey.

<div> elements are generic block elements by default.
<span> elements are generic inline elements by default.

That's the difference between the two. It doesn't really have to do with the parent/child relationship.

Oh, I see...

I'm still learning :lol:
My Developing Blog (7)
Wedevoy.com - In Development... should be done in about a week or so

Post May 11th, 2008, 11:13 pm

JISForums wrote:
Didya put the links on <a href=Websiteaddresshere></a>

What?
</thats_what_she_said>

Post Information

  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2008. Driven by phpBB © 2001-2008 phpBB Group.

 
 
 
 

Need a pre-made web design for your website?

Check out our templates here: Ozzu Templates


400+ FREE Website Templates. Download Now!