怎样将php背景照片覆盖,HTML – 如何使背景覆盖一个单独的div?

使用背景图像和3个不同元素的基本方法(防止xBrowser主要与Safari相关的问题)

设置背景以覆盖#bg图层元素

*{ box-sizing: border-box;}

html, body{ height:100%; }

body{ position:static; margin:0; }

#bg{

background: url('http://www.gettyimages.ca/gi-resources/images/Homepage/Hero/UK/CMS_Creative_164657191_Kingfisher.jpg') 50%;

background-size: cover;

position: fixed;

top: 0; right: 0; bottom: 0;

width: 70%;

}

#menu{

position: fixed;

bottom: 0; top: 0; left: 0;

width: 30%;

background: rgba( 0, 0, 255, 0.4 );

}

#page{

position: relative;

border: 10px dashed #000;

margin-left: 30%;

width: 70%;

height: 2000px;

}

BG
SCROLLABLE

在该代码之上,您可以随意应用CSS3媒体查询.

请注意,“最简单”不是使用单独的#bg元素,而是使用background-attachment:fixed将bg图像直接设置为#page元素;但是,正如所提到的,图像可能不会出现在Safari上,并且其大小设置为覆盖.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值