简体   繁体   English

CSS中的背景图像不透明度(在Dreamweaver中工作)

[英]Background Image opacity in CSS (working in dreamweaver)

Working in Dreamweaver, I'm trying to get a background image that is the same on every page. 在Dreamweaver中工作,我试图获取每页上相同的背景图像。 I want it to be set and fill the whole page, have content scroll not the picture, and I need the picture to be a bit transparent, so the text will be easier to read. 我希望设置它并填充整个页面,让内容滚动而不是图片,并且我需要图片有点透明,因此文本将更易于阅读。 I have NO idea how to do opacity other than that this is what I have in my Style.css class. 除了这是我在Style.css类中具有的功能之外,我不知道如何进行不透明度。

body {
    overflow-x: hidden;
    width: 100%;
    background-image:
         url(/CuzbZDV%5B1%5D.jpg);
    background-repeat: no-repeat;
    background-position: top center;
    background-attachment: fixed;
}

Try with that: 试试看:

body:before {
  position: fixed;
  z-index: -1;
  content: " ";
  top: 0; left: 0; right: 0; bottom: 0;
  background: url() no-repeat center center fixed;
  background-size: cover;
  opacity: .5;
  filter: alpha(opacity=50); /* IE8, I believe... */
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM