]."/> ].">

Home  >  Article  >  Web Front-end  >  add watermark to image with css

add watermark to image with css

王林
王林forward
2020-10-26 16:13:154787browse

add watermark to image with css

Purpose:

Add watermarks to some pictures.

(Learning video recommendation: css video tutorial)

Picture and watermark display area

<div class="watermark-image"></div>

Style

.watermark-image {
  position: relative;

  width: 300px;
  height: 300px;

  background: url(&#39;https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489746806388&di=68436cfc9319b2f3afeffa9a984a2dc2&imgtype=0&src=http%3A%2F%2Fimg5.duitang.com%2Fuploads%2Fitem%2F201605%2F19%2F20160519224441_VfMWR.thumb.700_0.jpeg&#39;) no-repeat;
  background-size: 300px;

  border: 1px dotted #f00;
}

.watermark-image:before {
  content: "Message here.";
  font-size: 21pt;

  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: -80px;

  background-color: rgba(255, 255, 0, 0.7);
  -webkit-transform:rotate(-45deg);
}

Related recommendations: CSS tutorial

The above is the detailed content of add watermark to image with css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete
Previous article:css style resetNext article:css style reset