SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best way to fix validation issue

    Hi,

    I get the following error whilst validating a page and would like know the best way around this:

    "document type does not allow element "h2" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag"

    my html:

    Code:
    <a href="/football-file/"><h2 class="fashion-file-h">my football file</h2></a>
    my css:
    Code:
    #content .football-file h2.football-file-h {
    	width:122px;
    	height:97px;
    	margin:-16px 0 0 0;
    	padding:0;
    	background:url(../images/myfile.gif) no-repeat;
    	text-indent:-9999px;
    	overflow:hidden;
    Would the following below work instead?

    Code:
    <a href="/football-file/"><span class="football-file-h">my football file</span></a>
    Code:
    .football-file-h {
    	width:122px;
    	height:97px;
    	margin:-16px 0 0 0;
    	padding:0;
    	background:url(../images/myfile.gif) no-repeat;
    	text-indent:-9999px;
    	overflow:hidden;
    }

    Thanks

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Probably. The <a> element is an inline type, so a block type element like <h2> shouldn't appear inside it.

  3. #3
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    You're having an H2 element in your link which is invalid.

    Instead, place the link inside your H2.

    Code HTML4Strict:
    <h2><a href="#">my link</a></h2>
    Maleika E. A. | Rockatee | Twitter | Dribbble



  4. #4
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah of course, thanks for reminding me


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •