【问题标题】:Curved header with pure CSS [duplicate]带有纯 CSS 的弯曲标题 [重复]
【发布时间】:2019-07-10 04:23:54
【问题描述】:

试图用纯 CSS 来钉住这个弯曲的标题,但使用边框半径并不能保持左右边框边缘像在图像中那样清晰。任何帮助将不胜感激。

【问题讨论】:

标签: css


【解决方案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>

【讨论】:

    猜你喜欢
    • 2017-05-27
    • 1970-01-01
    • 2018-10-28
    • 1970-01-01
    • 2019-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多