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 6060887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:52:34+00:00 2026-05-23T08:52:34+00:00

Is there a lightweight CSS or Javascript snippet that will allow me only make

  • 0

Is there a lightweight CSS or Javascript snippet that will allow me only make the selection/highlighting of things on a page only available to text? It’s always annoyed me when you’re trying to highlight text and you end up highlighting divs and images and things.

Is there a way ONLY to highlight text? That would include paragraph, anchors, text inside divs & images, and all header tags.

Thanks!
~ Jackson

I’m uploading the results anyone who who answers this, I’m currently running @Nick Radford ‘s code he ETA’d.

Here it is, and it’s closer, still a lot of selection besides text going on with ctrl+a:
http://designsweeter.com/

  • 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-23T08:52:34+00:00Added an answer on May 23, 2026 at 8:52 am
    html{ 
        -o-user-select: none;
        -moz-user-select: none;
        -webkit-user-select: none;
        user-select: none; 
    }
    p,a,h1,h2,h3,h4,h5,h6,div,br,li,td,article{
        -o-user-select: text;
        -moz-user-select: text;
        -webkit-user-select: text;
        user-select: text;
    }
    

    The first block disables selection in html, the second re-enables it to any item that can contain text as of HTML5. It’s pretty big, but minified, it’s smaller:

    html{-moz-user-select:none;-o-user-select:none;-webkit-user-select:none;user-select:none}p,a,h1,h2,h3,h4,h5,h6,div,br,li,td,article{-moz-user-select:text;-o-user-select:text;-webkit-user-select:text;user-select:text}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any lightweight validation library available for PHP that easily can check if
Is Protocol Buffer for .NET gonna be lightweight/faster than Remoting(the SerializationFormat.Binary)? Will there be
MSDN says that you should use structs when you need lightweight objects. Are there
Is there a good lightweight framework for java that provides the publish/subscribe pattern? Some
Is there a one liner that shows me the dates where all git lightweight
I'm looking for a lightweight solution that will let me spread out the responsibility
Is there a lightweight process execution timer like Unix's time included with Windows? Sometimes
Is there a simple and lightweight program to search over a text file and
Is there an alternative ActionScript 3 lightweight framework out there similar to Flex, but
There is a conversion process that is needed when migrating Visual Studio 2005 web

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.