CSS底部三角背景

时间:2017-01-09 06:53:38

标签: css3 background-image

我想用背景创建相同的底部三角效果,但我无法通过背景图像获得此效果底部三角形。 enter image description here

我在这里添加了代码但没有得到相同的效果。底部箭头我无法像在图像中那样扩展。

.logo,.nav,.social-icons{ float:left;}
body{ color:#000; background:#ccc;}
.container{border:1px solid red;}
.clear{ clear:both;}
html,body{margin:0;padding:0;}


/*****************************
BANNER
*****************************/
.section {
    height: 680px;
    width: 100%;
   background: url("http://i.imgur.com/YtluDV9l.jpg") no-repeat left top;
   background-size:cover;
}
.bottom-container {
    margin-top: -137px;
    height: 100px;
    width: 100%;
}
.text {
    position: relative;
    box-sizing: border-box;
    height: 300px;
    padding-top: 36px;
    text-align: center;
    line-height: 85px;
    background: url("http:////i.imgur.com/uCYtKen.jpg") no-repeat left top;
    background-clip: content-box;
    overflow: hidden;
    margin: 25px 0 0 0;
}
.text:before {
    left: 0px;
    width: 26%;
    transform-origin: left bottom;
    transform: skew(-134deg);
}
.text:after, .text:before {
    position: absolute;
    content: '';
    top: 0px;
    height: 35px;
    background: #fff;
}
.text:after {
    right: 2px;
    width: 74%;
    transform-origin: right bottom;
    transform: skew(-226deg);
}
<body>
      <!--WRAPPER:STARTS--> 
       <div id="wrapper">
       	 <!--HEADER:STARTS-->
         
         <!--BANNER:STARTS-->
         <section class="section">
</section>
<div class="bottom-container">
  <div class="text">Some text</div>
  <div class="middle-image"></div>
  <div class="right-image"></div>
</div></div>
</body>

1 个答案:

答案 0 :(得分:1)

html,body{background:url(http://i.imgur.com/ixr4wNC.jpg); height:100%;padding:0;margin:0;overflow:hidden;}
.line {
  margin-top: 50px;
  height: 5px;
  width: 20%;
  background: #fff;
  position: relative;
  box-sizing: border-box;
}
.line:after,
.line:before {
  content: "";
  position: absolute;

}
.line:after {
  left: calc(100% + 2px);
  height: 25px;
  width: 25px;
  top: -12px;
  border-top: 5px solid #fff;
  border-left: 5px solid #fff;
  transform: rotate(225deg);
}
.line:before {
  height: 100%;
  top: 0;
  left: calc(100% + 34px);
  width: 400px;
  background: inherit;
}
<div class="line"></div>
  

这与您正在寻找的相同吗?

这是JSFiddle

希望这有帮助。