Results 1 to 7 of 7

Do you know how to fix this error?

This is a discussion on Do you know how to fix this error? within the Off-Topic & Chit Chat forums, part of the Focus on Members category; [Invalid] Markup Validation of http://malesopranos.com/forums - W3C Markup Validator I had a coder make a 'Latest Videos' module in my ...

  1. #1
    Senior Member
    Real Name
    Arkidas
    Join Date
    Feb 2008
    Posts
    254
    Liked
    0 times

    Do you know how to fix this error?

    [Invalid] Markup Validation of http://malesopranos.com/forums - W3C Markup Validator

    I had a coder make a 'Latest Videos' module in my sidebar. However, he made one error ( it says 15 because there are 15 thumbnails. It's not really an error but it makes my site non-xhtml validated everywhere ).

    I guess it's an easy fix but I know very little about this. Here's the template:

    HTML Code:
    <div class="videoBox">
    <a href="$tube[link]"><div style="position: relative"><img width="60" height="45" alt="$tube[title]" src="$tube[link1img]" /><div style="position: absolute; width: 60px; height: 60px; top: 0px; left: 0px; background: url(/images/styles/sopranos/style/corners_vid.png) no-repeat;"></div></div></a>
    </div>
    Note that a dummy image is used to make thumbnails rounded and that's why there are two divs.

  2. #2
    Senior Member Shadab's Avatar
    Real Name
    Shadab
    Join Date
    Oct 2007
    Location
    Bhopal
    Posts
    821
    Liked
    0 times
    Blog Entries
    12
    A <div> can't be put inside an anchor <a href="">.

    So, try this :
    HTML Code:
    <div class="videoBox">
       <div style="position: relative">
          <a href="$tube[link]">
             <img width="60" height="45" alt="$tube[title]" src="$tube[link1img]" />
          </a>
          <div style="position:absolute;width:60px;height:60px;top:0px;left:0px;
             background: url(/images/styles/sopranos/style/corners_vid.png) no-repeat;">
          </div>
       </div>
    </div>
    or this :
    HTML Code:
    <div class="videoBox">
       <a href="$tube[link]">
          <img width="60" height="45" alt="$tube[title]" src="$tube[link1img]" />
       </a>
    </div>

  3. #3
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    yup... you can't put a block-level element (the div) into an inline element (the a)


    I think the best way to mark that up would be:

    Code:
    <div class="videoBox">
        <a href="$tube[link]" class="tubeanchor"><img src="$tube[link1img]" width="60" height="45" alt="$tube[title]" /></a>
    </div> 
    
    
    .tubeanchor {
        width: 60px;
        height: 60px;
        background: url(/images/styles/sopranos/style/corners_vid.png) no-repeat;
        padding: 7px 0;
        margin: 0;
        border: 0;
    }
    Obviously, place the CSS class into your MAIN CSS extras box (at the bottom), not in the template itself.

    untested- might need a tweak.

  4. #4
    Senior Member
    Real Name
    Arkidas
    Join Date
    Feb 2008
    Posts
    254
    Liked
    0 times
    Thanks to both of you !

    Brian's solution would probably be cleanest if it'd work but for some reason the corners weren't smooth with it.

    The solution below ( Shadab's first solution ) seems to work perfectly but I'd still like to use Brian's if he can figure out what's wrong with it since it's a bit cleaner.

    HTML Code:
    <div class="videoBox">
       <div style="position: relative">
          <a href="$tube[link]">
             <img width="60" height="45" alt="$tube[title]" src="$tube[link1img]" />
          </a>
          <div style="position:absolute;width:60px;height:60px;top:0px;left:0px;
             background: url(/images/styles/sopranos/style/corners_vid.png) no-repeat;">
          </div>
       </div>
    </div>

  5. #5
    Senior Member
    Real Name
    Arkidas
    Join Date
    Feb 2008
    Posts
    254
    Liked
    0 times
    Apparently, this solution above doesn't really work. it removes the link on the image, making it the thumbnails quite useless. I'm quite surprised I just noticed this now. Any suggestions?

  6. #6
    Senior Member
    Real Name
    Arkidas
    Join Date
    Feb 2008
    Posts
    254
    Liked
    0 times
    Any way to remove the error without removing any functionality?

  7. #7
    Senior Member
    Real Name
    Arkidas
    Join Date
    Feb 2008
    Posts
    254
    Liked
    0 times
    Last try .

Similar Threads

  1. Replies: 9
    Last Post: 09-15-2008, 02:05 PM
  2. [Error] xhtml coding error on my part - please help
    By jbartle in forum Template Modifications
    Replies: 3
    Last Post: 01-24-2008, 11:50 PM
  3. Internal Server error - Log error posted here
    By candg in forum Troubleshooting
    Replies: 2
    Last Post: 08-06-2007, 06:46 AM
  4. vBSEO error in error log
    By Mert Gökçeimam in forum Troubleshooting
    Replies: 5
    Last Post: 02-26-2007, 11:41 AM

Posting Permissions

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