css - 圆 Angular 边 Angular

标签 css

我想知道如何使顶部边框像下图的红线一样?我试过 border-radius,但我不知道如何将上边框的底部圆化。

enter image description here

最佳答案

我会使用 :before 来创建一个可以设置样式的伪元素,因为它仅用于演示,所以使用空元素会显得冗长。

这是一个如何做到这一点的例子:

.splitter {
  border: 1px solid #ddd;
  border-top: 0;
}
  .splitter:before {
    content: ' ';
    display: block;
    position: relative;
    top: -5px;
    width: 100%;
    height: 8px;
    background-color: red;
    border-radius: 100px / 70px;
  }

.myContent {
  padding: 0 20px;
}
<div class="splitter">
  <div class="myContent">
    <h1>React or Angular</h1>
    <p>Lorem ipsum Mollit qui sunt consequat deserunt exercitation veniam.</p>
  </div>
</div>

也可以在 JS Bin 上看到:

http://jsbin.com/hoqizajada/edit?html,css,output

关于css - 圆 Angular 边 Angular ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36838062/

相关文章:

html - 两列布局

javascript - 如何使用cq :includeClientLib in CQ5 to include CSS and Javascript

javascript - jQuery 的 offset() 函数

css - 使用 Shopify 时 mozilla 上的@font-face 问题

javascript - 视频模态 Bootstrap

php - HTML 文件是否可以指向一组外部链接?

php - 如何在 css 容器中加载数据库条目

html - CSS 悬停图像

css - 一些 Glyphicons 显示为空框 Bootstrap 3?

html - <li> 元素在移动版本中不会垂直对齐