跳到正文

科技·工程

轮廓线移除

Forever_Rain约 1 分钟
原文
文章信息与版本

文章信息

收录
2026年5月4日
更新
2026年6月27日
篇幅
约 1 分钟

版本

  1. v2当前
  2. v1

现在新版Chrome主页会在点击时出现黑色边框,是因为 :focus 属性,原理就是把它移除。

JavaScript
// ==UserScript==
// @name         轮廓线移除
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  全局移除所有元素获得焦点时的轮廓线
// @author       Forever_Rain
// @match        https://www.luogu.com.cn/*
// @grant        GM_addStyle
// @run-at       document-start
// @all-frames   true
// ==/UserScript==

(function() {
    'use strict';
    GM_addStyle(`
        *:focus, *:focus-visible {
            outline: none !important;
        }
    `);
})();
原文