【发布时间】:2018-11-21 07:35:29
【问题描述】:
我想知道如何使底部功能区显示功能区的左侧和右侧?顶部的显示非常好,但是当我向页面添加背景颜色时,功能区的左侧和右侧消失了。
我已经被这个问题困扰了一段时间,所以我想知道解决这个问题的解决方案是什么?先感谢您!
body {
text-align: center;
}
section {
background-color: aqua;
}
h6 {
display: inline-block;
font-size: 34px;
line-height: 28px;
color: #8699a0;
text-shadow: 0 0 1px #758890;
margin: 120px 0;
font-family: arial, verdana;
outline: none;
padding: 14px 30px;
position: relative;
text-transform: uppercase;
box-shadow:
0 0 30px 0 rgba(0, 0, 0, 0.1),
0 36px 0 -18px #b1e3e2;
}
/*the ribbon ends*/
h6:before {
content: "";
position: absolute;
top: 18px;
left: -15%;
z-index: -1;
width: 130%;
/*Using the triangle logic - 2-sided borders and 0 height. That will create negative triangles on the left and right.*/
height: 0;
border: 28px solid rgba(0, 0, 0, 0);
border-left: 28px solid #b1e3e2;
border-right: 28px solid #b1e3e2;
}
h6:after {
content:"";
width: 100%;
height: 0;
position: absolute;
top: 100%;
left: 0;
z-index: -1;
border-top: 18px solid #99acb2;
border-left: 18px solid transparent;
border-right: 18px solid transparent;
}
h6, h6:before {
background-image:
/*2 gray borders*/
linear-gradient(
transparent 8%,
rgba(0, 0, 0, 0.1) 8%,
rgba(0, 0, 0, 0.1) 14%,
transparent 14%,
transparent 86%,
rgba(0, 0, 0, 0.1) 86%,
rgba(0, 0, 0, 0.1) 92%,
transparent 92%
),
/*white gloss gradient*/
linear-gradient(
rgba(255, 255, 255, 0.75),
rgba(255, 255, 255, 0)
),
/*thin stripes*/
linear-gradient(
45deg,
transparent 40%,
rgba(0, 0, 0, 0.1) 40%,
rgba(0, 0, 0, 0.1) 60%,
transparent 60%
),
/*white base*/
linear-gradient(white, white);
background-size:
cover, /*borders*/
cover, /*white gloss*/
4px 4px, /*thin stripes*/
cover; /*base white*/
}
h6, h6:before, h6:after {
box-sizing: border-box;
/*fix to make the borders appear on the ribbon ends as well*/
background-origin: border-box;
}
<h6>BUY ONLINE AND SAVE</h6>
<section>
<h6>BUY ONLINE AND SAVE</h6>
</section>
【问题讨论】: