Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
How to disable iframe from being highlighted

When I double click the white background, the iframe becomes highlighted, how do I disable that via css?

https://jsfiddle.net/516y29ka/

To reproduce, double mouse click the white background and you will see the iframe become highlighted.

How is that disabled via css?

<iframe width="642" height="361" src="https://www.youtube.com/embed/M7lc1UVf-VE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

enter image description here

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Use user-select: none; on the iframe.

<!DOCTYPE html>

<head>
  <style>
    .video-frame {
      user-select: none;
    }
  </style>

  <body>

    <iframe class="video-frame" width="642" height="361" src="https://www.youtube.com/embed/M7lc1UVf-VE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

  </body>

  </html>

It's supported by almost all browsers: https://caniuse.com/?search=user-select
For more info refer spcifications: https://www.w3.org/TR/2021/WD-css-ui-4-20210316/#propdef-user-select

over 4 years ago · Santiago Trujillo Report

0

Use user-select and set it to none To avoid compatibility issues, add vendor prefixes: -webkit- -ms- -moz- -o-

    .video-frame {
        user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
    }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!