纯CSS的弯曲标头

时间:2019-02-16 02:21:29

标签: css css3

尝试使用纯CSS固定此弯曲的标头,但使用边框半径不能使左右边框的边缘保持图像中的清晰度。任何帮助将不胜感激。Curved header

1 个答案:

答案 0 :(得分:1)

您可以通过多种方式执行此操作,其中之一就是使用border-radius。因此,对于形状,您只需要具有border-bottom-left-radius:border-bottom-right-radius:

我在这里附加了代码,

body{
  background-color:#f3f2f4;
}
.header{
  width:105%;
  height:40%;
  left:-3%;
  position:absolute;
  background-image: linear-gradient(#8459f9, #4c3196);
  border-top-left-radius:10px;
  border-top-right-radius:10px;
  border-bottom-left-radius: 50% 20%;
  border-bottom-right-radius: 50% 20%;
}
.container{
  width:60vw;
  height:80vh;
  background-color:white;
  border-radius:10px;
  position:absolute;
  top:50%;
  overflow:hidden;
  left:50%;
  transform:translate(-50%,-50%);
}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div class="container">
  <div class="header">
    </div>  
  </div>
</body>
</html>

相关问题