小编use*_*314的帖子

如何制作::选择背景不透明度:1?

这可能吗?我希望所选文本具有纯色背景,而不是透明背景.opacity: 1不这样做是因为必须有来自浏览器的标准覆盖(或类似的东西).

::-moz-selection {
  background: #fff;
  color: #000;
}

::selection {
  background: #fff;
  color: #000;
}

body {
  color: #fff;
  font-family: sans-serif;
  line-height: 2em;
}

div {
  padding: 2em;
  background: #F8372A;
  text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
<div>
  <h1>HEY!</h1>
  <p>why is my background not<br/><strong>STARK WHITE</strong><br/>when selected?</p>
</div>
Run Code Online (Sandbox Code Playgroud)

html css background selection opacity

6
推荐指数
1
解决办法
2310
查看次数

标签 统计

background ×1

css ×1

html ×1

opacity ×1

selection ×1