跳转到帖子
在手机APP中查看

一个更好的浏览方法。了解更多

OKCCN - XenForo & IPS Plugin Marketplace

主屏幕上的全屏APP,带有推送通知、徽章等。

在iOS和iPadOS上安装此APP
  1. 在Safari中轻敲分享图标
  2. 滚动菜单并轻敲添加到主屏幕
  3. 轻敲右上角的添加按钮。
在安卓上安装此APP
  1. 轻敲浏览器右上角的三个点菜单 (⋮) 。
  2. 轻敲添加到主屏幕安装APP
  3. 轻敲安装进行确认。
  • 选择语言

推荐的帖子

  • 行政经理

CSS Masking


The CSS mask-image Property

CSS masking allows you to create a mask layer to place over an element to partially or fully hide portions of the element.

The CSS mask-image property specifies a mask layer image.

The mask layer image can be a PNG image, an SVG image, a CSS gradient, or an SVG <mask> element.


Use a PNG Image as the Mask Layer

To use a PNG image as the mask layer, use a url() value to pass in the mask layer image.

The mask image needs to have a transparent or semi-transparent area. Black indicates fully transparent.

Here is the mask image ("w3logo.png") we will use:

W3Schools.com

Here is an image from Cinque Terre, in Italy:

Cinque Terre

Now, we apply the mask image as the mask layer for the image from Cinque Terre, Italy:

Cinque Terre

Example

Here is the source code:

.mask1 {
  -webkit-mask-image: url(w3logo.png);
  mask-image: url(w3logo.png);
  mask-repeat: no-repeat;
}
Try it Yourself »

The mask-image property specifies the image to be used as a mask layer for an element.

The mask-repeat property specifies if or how a mask image will be repeated. The no-repeat value indicates that the mask image will not be repeated (the mask image will only be shown once).



Repeat the Mask Layer Image

If we omit the mask-repeat property, the mask image will be repeated all over the image from Cinque Terre, Italy:

Cinque Terre

Example

Omit the mask-repeat property:

.mask1 {
  -webkit-mask-image: url(w3logo.png);
  mask-image: url(w3logo.png);
}
Try it Yourself »

Position the Mask Layer Image

The mask-position property sets the starting position of a mask image (relative to the mask position area). By default, a mask image is placed at the top-left corner of an element, and repeated both vertically and horizontally.

Here, we position the mask image in center:

Cinque Terre

Example

Position the mask layer image:

.mask1 {
  -webkit-mask-image: url(w3logo.png);
  mask-image: url(w3logo.png);
  mask-repeat: no-repeat;
  mask-position: center;
}
Try it Yourself »

CSS All Masking Properties

The following table lists all the CSS masking properties:

Property Description
mask-clip Specifies which area is affected by a mask image
mask-composite Specifies a compositing operation used on the current mask layer with the mask layers below it
mask-image Specifies an image to be used as a mask layer for an element
mask-mode Specifies whether the mask layer image is treated as a luminance mask or as an alpha mask
mask-origin Specifies the origin position (the mask position area) of a mask layer image
mask-position Sets the starting position of a mask layer image (relative to the mask position area)
mask-repeat Specifies how the mask layer image is repeated
mask-size Specifies the size of a mask layer image
mask-type Specifies whether an SVG <mask> element is treated as a luminance mask or as an alpha mask

参与讨论

你可立刻发布并稍后注册。 如果你有帐户,立刻登录发布帖子。

游客
回帖…

帐户

导航

搜索

搜索

配置浏览器推送通知

Chrome (安卓)
  1. 轻敲地址栏旁的锁形图标。
  2. 轻敲权限 → 通知。
  3. 调整你的偏好。
Chrome (台式电脑)
  1. 点击地址栏中的挂锁图标。
  2. 选择网站设置。
  3. 找到通知选项并调整你的偏好。