Select Language:
If you’re trying to remove the yellow highlight that appears when you copy text from a webpage, here’s a simple way to fix it. That bright yellow box can be distracting and isn’t always necessary.
The trick is to modify your CSS to prevent the highlight from showing. Specifically, you want to target the element with the user-select property set to none or use ::selection to specify what gets highlighted when text is selected and to disable it.
Here’s what you can do:
- Add to your CSS a rule that targets the element you want to change. For example:
css
/ This disables the default highlight color when selecting text /
::selection {
background: transparent; / Makes the background transparent when text is selected /
color: inherit; / Keeps the text color unchanged */
}
/ Or, if you prefer to remove highlighting altogether from specific elements /
.selector {
user-select: none; / Prevents text from being selected, so no highlight appears /
}
- If you only want to disable the highlight during copying or selection, add this rule:
css
/ Disable highlight for specific class or ID /
your-element-id {
user-select: none; / Prevent selection and thus highlight /
}
- Apply these styles in your CSS file or within a
<style>tag inside your webpage’s<head>section.
By doing this, the bright yellow highlight that appears when copying text will be gone. Remember, using user-select: none; will disable text selection on that element, so use it only if you don’t need users to select the text.
This is an easy fix that enhances user experience by making the copy process cleaner and less visually distracting.




