html - 在css中创建十字图像水印

标签 html css

我的需要是创建一个如图所示的十字图像。 Div 1 没有固定的高度,有时会发生变化。
那么如何在 Div 1 中创建十字水印呢?

我尝试过喜欢

.cross01 {
width:520px;
height:100%;
background:url(../images/cross01.png) repeat-y;
position:absolute;
top:0px;
z-index:1000;

}

最佳答案

您可以向图像添加包装器并使用后选择器。

SEE DEMO

CSS

.watermark {
    position: relative;
}
.watermark:after {
    background: none repeat scroll 0 0 rgba(255, 255, 255, 0.8);
    bottom: 0;
    content: " ";
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

HTML

<div class="watermark">
    <img src="http://ecx.images-amazon.com/images/I/61BcAJJgyXL._SX450_.jpg"></img>
</div>
<div>
    <img src="http://ecx.images-amazon.com/images/I/61BcAJJgyXL._SX450_.jpg"></img>
</div>

关于html - 在css中创建十字图像水印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16856491/

相关文章:

javascript - 为什么在数字输入中放置新值时总数不更新

html - 无法使用滚动条使 DIV 宽度为 100%

html - 将多个较小的单词与一个较大的单词对齐?

html - 在元素的默认样式或元素 :hover? 中设置光标

javascript - target 属性的 CSS 版本

html - 当一个 100vw 的元素在一个不居中且不全宽的容器内时,如何使它居中?

python - 使用 python flask 框架在 html 正文中设置背景图像

html - Flex 在 Firefox 中无法正常工作

css - 移动 CSS 高度 100% + 浏览器 chrome?

css - 设置三星智能电视应用程序的背景图像大小?