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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:26:05+00:00 2026-05-27T05:26:05+00:00

I changed the text highlight color using ::selection , which works pretty in my

  • 0

I changed the text highlight color using ::selection, which works pretty in my page. However, I found the Chrome behaves different from FF, which highlight the <br> with default blue color instead of the color I set for all the elements. FF doesn’t hightlight the <br> so it works fine.

I tried to override the ::selection for <br>, doesn’t work; Tried to use user-select:none;, doesn’t work either; Tried display:none;, which simply made my <br> all disappeared…

Any idea?

  • 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-27T05:26:06+00:00Added an answer on May 27, 2026 at 5:26 am

    I think you would need read this question with all its answers.

    By the way if you need to simulate this behavior in Chrome I think you can simulate a <br/> with <span>. Something like this:

    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <style>
    p.normal::selection {
        background:#cc0000;
        color:#ff0;
    }
    p.normal span::selection {
        background:#cc00ff;
        color:#ff0;
    }
    p.normal span {
        width:100%;
        clear:left;
        display: block;
        height: 1em;
    }
    
    p.moz::-moz-selection {
        background:#cc0000;
        color:#ff0;
    }
    
    p.webkit::-webkit-selection {
        background:#cc0000;
        color:#ff0;
    }
    </style>
    </head> 
    <body>
        <p class="normal">Hello Normal
        <span></span>
        <span></span>
        <span></span>
        How are you?
        </p>
        <p class="moz">Hello Mozilla
        <br/>
        <br/>
        <br/>
        How are you?
        </p>
        <p class="webkit">Hello Webkit
        <br/>
        <br/>
        <br/>
        How are you?
        </p>
    </body>
    </html>
    

    EDIT:

    After several tests, I concluded that to replicate the behavior in Chrome you would need a javascript that replicate this styles.

    EDIT2:

    To remove the pink border in the second line I make another demo (I think it’s more clear).

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

Sidebar

Related Questions

I've been using the following CSS3 option to change the highlight color of text
How do I change text color using flash actionscript 2?
I'm using the .animate function from the jquery.color.js library to highlight a label on
WPF uses the system highlight color for painting the background of the selected text.
I need to highlight changes(diff) between 2 database text fields in a asp.net application.
I'm try to change text color and align item in spinner to center of
I'm using the After Effects CS3 Javascript API to dynamically create and change text
i've a basic php search form which highlights the keywords using css. i was
Our site's UI displays read-only text fields which have mouse-click handlers -- when the
We have created custom listview by using the Base adapter. List view contains Text

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.