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

  • SEARCH
  • Home
  • 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 7867329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:41:03+00:00 2026-06-03T00:41:03+00:00

I am creating a web page and have a section that I want to

  • 0

I am creating a web page and have a section that I want to be linked, inside this section though I have some text that I want to allow the user to copy and paste from (i.e they need to be able to highlight it). Because the text is inside the linked div though I am unable to select it, how can I make the text selectable?

Here is the code I have…

<a href="http://google.com">
    <div class="container"> 
        <h2>Heading</h2>
        <p class="selectable-text">Text that can be highlighted here</p>
        <p>Other Text</p>
    </div>
</a>

I’ve tried putting this in the CSS, but this just changed the cursor, it didn’t actually make the text selectable…

.selectable-text{
    cursor:text;
}

Thanks in advance for any help.

  • 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-06-03T00:41:08+00:00Added an answer on June 3, 2026 at 12:41 am

    a-Elements don’t allow block-elements inside of them. So you cannot structure your layout that way. What about only making the heading a link? That would be fine and you could easily select the other text:

    <div class="container"> 
        <h2><a href="http://example.com">Heading</a></h2>
        <p>Text that can be highlighted here</p>
        <p>Other Text</p>
    </div>
    

    In order to make the whole container clickable, you can apply a Javascript Event Listener to all containers. If you are already using jQuery, this can be done very easily:

    $('.container').each(function(){
        $(this).on('click', function(){
            location.href = $(this).find('a').attr('href');
        });
    }).addClass('link');
    

    The difference from this to a “real” link is that it won’t be draggable and instead selectable. Anyway you can click on it and it will locate you to where you want to go. It will also apply a class .link which you can use in your stylesheet in order to set a pointer as the cursor.

    For people who have javascript disabled there will still be a link in the heading, so your page stays usable in every case.

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

Sidebar

Related Questions

I am creating a web page, where I have an image that I want
I am creating a web page where I have an input text field in
I have a web page that has a few text boxes, and a dual
I'm creating a web page that user can send pm , receive it,add contact,response
I'm creating a form on a web page, but I want that form to
I'm creating a web page to select some options from a CSV file: CSV
I'm creating a web site that I think must have a client side database.
I use Asp.NET Mvc 3 for creating web page and so I detect that
I'm creating a web page for my internship and I want to add a
I have a web page that sends a request to a cgi script that

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.