图片水印和水印字

1.水印文字

```

        <html>

<head>

<meta charset="utf-8">

<title>img</title>

<style type="text/css">

.parentBox{

position: relative;

width: 200px;

height: 300px;

}

.parentBox img{

width: 100%;

height: 100%;

}

.parentBox .sk{

position: absolute;

width: 100px;

height: 100px;

top: calc(50% - 50px);

left: calc(50% - 50px);

background: rgba(100,100,100,.6);

border-radius: 50%;

text-align: center;

line-height: 100px;

color: #fff;

border: 5px solid #aaa;

font-size: 20px;

}

</style>

</head>

<body>

<div class="parentBox">

<img src="img/productImg.jpg" alt="">

<div class="sk">售完</div>

</div>

</body>

</html>

```

效果


2.图片作为水印

```

<!DOCTYPE html>

<html>

<head>

<title>img</title>

.parentBox{

position: relative;

width: 200px;

height: 300px;

}

.parentBox img{

width: 100%;

height: 100%;

}

.parentBox .sk{

position: absolute;

width: 100px;

height: 100px;

top: calc(50% - 50px);

left: calc(50% - 50px);

background: rgba(100,100,100,.6);

border-radius: 50%;

text-align: center;

line-height: 100px;

color: #fff;

/* border: 5px solid #aaa; */

font-size: 20px;

background: url(img/sellOut.png) no-repeat;

background-size: 100%;

}

</style>

</head>

<body>

img/productImg.jpg" alt="">

</div>

</div>

</body>

</html>

```

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容