Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 不透明度不工作,即使我没有发现语法错误_Html_Css_Opacity - Fatal编程技术网

Html 不透明度不工作,即使我没有发现语法错误

Html 不透明度不工作,即使我没有发现语法错误,html,css,opacity,Html,Css,Opacity,我正在尝试放置中等不透明度的背景图片,但无法这样做,以下是我的html:- 不要调整主体元素,而是添加一个额外的div来保存背景,最好将样式分离到css文件中 #背景{ 位置:固定; 排名:0; 左:0; 宽度:100%; 身高:100%; 背景图像:url('http://i40.tinypic.com/3531bba.jpg'); 背景重复:无重复; 背景附件:固定; 背景大小:100%; 不透明度:0.4; } 你最喜欢的旅行伙伴 使用div而不是body标记。给那个div一个特定的

我正在尝试放置中等不透明度的背景图片,但无法这样做,以下是我的html:-


不要调整主体元素,而是添加一个额外的div来保存背景,最好将样式分离到css文件中

#背景{
位置:固定;
排名:0;
左:0;
宽度:100%;
身高:100%;
背景图像:url('http://i40.tinypic.com/3531bba.jpg');
背景重复:无重复;
背景附件:固定;
背景大小:100%;
不透明度:0.4;
}

你最喜欢的旅行伙伴

使用div而不是body标记。给那个div一个特定的高度

 <!DOCTYPE html>
        <head>
        <title>Your favourite travle partner</title>
        </head>

        <body>
            <div style="margin:auto;width:100%;height:400px;opacity:0.1;background-image:url('http://www.menucool.com/slider/jsImgSlider/images/image-slider-2.jpg')">

    </div>
        </body>

        </html>`

你最喜欢的旅行伙伴
`

如何创建代码段?我是新来的,可能是