css清除css样式_CSS选择样式

css清除css样式

The goal of CSS is to allow styling of content and structure within a web page.  We all know that, right?  As CSS revisions arrive, we're provided more opportunity to control.  One of the little known styling option available within the browser is text selection styling.  Windows provides an ugly dark blue color for text selection and Mac provides a lighter blue color.  Mozilla Firefox, Internet Explorer 9, Opera, and Webkit-based browsers allow you to customize the styling of selected text.  Let me show you how.

CSS的目标是允许样式化网页内的内容和结构。 我们都知道,对不对? 随着CSS修订版本的到来,我们将获得更多的控制机会。 浏览器中鲜为人知的样式选项之一是文本选择样式。 Windows提供了丑陋的深蓝色用于文本选择,而Mac提供了较浅的蓝色。 使用Mozilla Firefox,Internet Explorer 9,Opera和基于Webkit的浏览器,可以自定义所选文本的样式。 让我告诉你怎么做。

CSS (The CSS)


/* webkit, opera, IE9 */
::selection { background:lightblue; }
/* mozilla firefox */
::-moz-selection { background:lightblue; }


The -moz prefixed property is obviously for Firefox while the basic ::selection selector is for Webkit-based browsers.  Much like the other CSS selectors, you can nest usage of selection to use different colors in different places and depths:

-moz前缀属性显然适用于Firefox,而基本:: selection选择器适用于基于Webkit的浏览器。 与其他CSS选择器非常相似,您可以嵌套使用选择,以在不同的位置和深度使用不同的颜色:


/* webkit, opera, IE9 */
div.highlightBlue::selection { background:lightblue; }
/* mozilla firefox */
div.highlightBlue::-moz-selection { background:lightblue; }

/* webkit, opera, IE9 */
div.highlightPink::selection { background:pink; }
/* mozilla firefox */
div.highlightPink::-moz-selection { background:pink; }


CSS selection styling is just another one of those simple touches you can add to make your website more refined and vibrant!

CSS选择样式只是您可以添加的一些简单操作中的一种,可以使您的网站更加精致和生动!

翻译自: https://davidwalsh.name/css-selection

css清除css样式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值