Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1060525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:20:24+00:00 2026-05-16T18:20:24+00:00

How do I rewrite this HTML to validate to XHTML 1.0 Strict? <div> <a

  • 0

How do I rewrite this HTML to validate to XHTML 1.0 Strict?

<div>
    <a href="link.html">
        <p>Some text</p>
        <ul>
            <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
        </ul>
    </a>
</div>

My intent is to have the entire div serve as a clickable link. The content within simply describes the contents of the destination page. W3 Validator says I can’t have a block element (<p>) inside a span tag (<a>).

How do I rearrange this so that my DIVs remain block links?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:20:25+00:00Added an answer on May 16, 2026 at 6:20 pm

    You’re not allowed to wrap a block level element in an inline level element so you have a few alternatives.

    • You can wrap every line that you want linked in the <a href="link.html">...</a>

      <div>
          <p><a href="link.html">Some text</a></p>
          <ul>
              <li><a href="link.html">Item 1</a></li>
              <li><a href="link.html">Item 2</a></li>
              <li><a href="link.html">Item 3</a></li>
          </ul>
      </div>​  
      
    • You can add a javascript onclick function to reproduce the same results.

       //jQuery
       ​$('div').click(function() {
           window.location = 'link.html';
       });​​​​​​
      
       //Non jQuery
       document.getElementById('yourDiv').onclick = function() {
           window.location = 'link.html';
       }
      
      • If you use the Javascript, make sure you use CSS to make it apparent that the contents are links. I’d recommend pseudo classes

        div {
            text-decoration: underline;
            color: #0000FF;//or whatever your link color is
        }
        div li:hover, p:hover {
            color: #CC00FF;
            cursor: pointer;
        }
        

        ​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link in my index.html: href=my_page.php?cat=14&p=1; Now, how can I rewrite this
This is the code (now is full): HTML: <div id=content contentEditable=true onkeyup=highlight(this)>This is some
I try to rewrite and customize @Html.ActionLink , in one of overloads of this
I am wanting to rewrite a url like: http://my.project/mydomain.com/ANY_NUMBER_OF_CATEGORIES/designer/4/designer-name/page.html to this: http://my.projects/mydomain.com/ANY_NUMBER_OF_CATEGORIES/page.html?designer=4 I would
I have this rewrite rule that turns foo.com/test (or foo.com/test/) into foo.com/test.txt: RewriteRule ^test/?$
This is using jQuery 1.6.1 and Validate 1.8.1. I have been banging my head
I am trying to rewrite this Jquery http://jsfiddle.net/Claudius/gDChA/4/ to use this HTML instead http://pastie.org/2370829
How do I rewrite this insert html Jquery: var element = findLastInput(this).clone(); element.insertAfter(findLastInput(this)); This
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The
I had this rewrite rule in my httpd conf file: RewriteRule (.*?)\.html $1.php?%{QUERY_STRING} [NC]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.