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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:36:01+00:00 2026-06-09T15:36:01+00:00

I want to disable text selection for specific elements. For example: p { -moz-user-select:

  • 0

I want to disable text selection for specific elements. For example:

p {
    -moz-user-select: none
}

span {
    -moz-user-select: text
}

​

<div>
    <p>first paragraph</p>
    <span>first span</span>
    <p>second paragraph</p>
    <span>second span</span>
</div>       

​
The first and second paragraph cannot be selected individually. However, if I select the first span and drag down to select the second span, the second paragraph will become selected in the process. I’d like to prevent this (it functions as expected in WebKit).

I’m using Firefox 14.0.1. JSFiddle for reference: http://jsfiddle.net/GFNDY/

  • 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-09T15:36:03+00:00Added an answer on June 9, 2026 at 3:36 pm

    Since the selection only “apparently” includes the <p>s (for instance if you copy, only the non-<p> tags are saved in the clipboard), then all you need to do is make sure the browser doesn’t color it; that can be done by overriding the default selection-style using the CSS ::selection specifier (::-moz-selection for Mozilla).

    So the CSS will have something like:

    p::-moz-selection {
        background: transparent;
        color: #000000;
    }
    

    Here’s a modified version of your demo that behaves as expected: Link.
    Hope that helped you in any manner!

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

Sidebar

Related Questions

I want to disable click on a certain <div> so that when you select
I want to enable/disable a text box based on selection of drop down items
I know about -moz-user-select : none; -webkit-user-select : none; -khtml-user-select : none; and it
I want to disable the selection of text in a textbox using a style
Basically i want a disable text field to show the value stored in a
I want to iterate thru single array and disable caching only for some elements.
I want to disable a set of checkbox based on selection of one textbox
Could you please compare the properties I want to disable a text box 'txtName'.
I want to disable selecting text and clicking in the middle of text in
how to disable the default newline that some HTML elements are createing. For example:

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.