我有一个背景图像和一个黑色阴影框(内嵌)覆盖(使之变暗)以使图像变暗,但是在移动设备上,页脚div超出了body标签的范围。尽管背景仍然呈现并延伸到页面,但阴影框并没有一直延伸。
任何帮助是极大的赞赏
的HTML:
<div class="footer">
<div class="container-fluid external-sites">
<div class="flex-parent">
<div class="flex-child child-1">
<a href="https://www.linkedin.com/in/andrew-waller-
b66180146" target="_blank">
<div class="box">
<i class="fa fa-linkedin fa-5x"></i>
</div>
</a>
</div>
<div class="flex-child child-2">
<a href="https://github.com/Adrw4" target="_blank">
<div class="box">
<i class="fa fa-github-square fa-5x"></i>
</div>
</a>
</div>
<div class="flex-child child-3">
<a href="https://www.instagram.com/adrw4/?hl=en"
target="_blank">
<div class="box">
<i class="fa fa-instagram fa-5x"></i>
</div>
</a>
</div>
<div class="flex-child child-4">
<a href="#">
<div class="box">
<i aria-hidden="true" class="fa fa-html5 fa-5x
fa-center"></i>
</div>
</a>
</div>
</div>
</div>
</div>
CSS:
body {
padding: 0;
margin: 0;
height: 100vh;
width:100;
}
body,
html {
background: fixed;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
min-height: 100%;
width: 100%;
background-image: url("../img/circuit-board.jpg");
margin: 0px;
padding: 0px;
content: '';
box-shadow: inset 0 0 0 10000px rgba(0,0,0,.7);
}
.text-box {
text-align: center;
color: white;
font-style: oblique;
}
.box {
text-align: center;
background-color: black;
margin: auto;
}
.external-sites {
height: 25%;
overflow: auto;
}
.flex-parent {
list-style: none;
-ms-box-orient: horizontal;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -moz-flex;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
justify-content: space-between;
}
.flex-child {
text-align: center;
width: 100vw;
padding: 2px;
}
.child-1 {
order: 1;
}
.child-2 {
order: 2;
}
.child-3 {
order: 3;
}
.child-4 {
order: 4;
}
/*==============================================================================external sites==*/
@media only screen and (min-width: 830px) {
body {
overflow: hidden;
}
.flex-child {
width: 400px;
}
}
最佳答案
根据所需的浏览器支持(无Edge&IE),可以将背景色设置为深灰色,并使用background-blend-mode
而不是大的box-shadow
。
body {
background-color: #444;
background-image: url(..img/yourImage.jpg);
background-blend-mode: multiply;
}
只是不要使用黑色作为
background-color
,否则您将看不到图像。通过更改颜色控制颜色的深浅。