html - 带圆 Angular 的倒三 Angular 形

标签 html css

我需要在我的网站标题中重新创建类似这样的效果。 我想通过 CSS 来做,任何人都可以帮助我,因为我被那个三 Angular 形困住了......

这是我的测试:

#main-nav {height:200px;width:1200px;background-color:#000}
#triangle {
    width: 0;
    height: 0px;
    border-style: solid;
    border-width: 300px 300px 0px 0px;
    border-color: #007bff transparent transparent transparent;
    border-radius: 70px 2px 2px 2px;
    margin: auto;
    top: -400px;
    position: relative;
    /* background-color: #ccc; */
    -moz-border-radius: 20px;
    transform: rotate(-135deg);
    /* border-top: 80px solid blue; */
    /* border-bottom: 80px solid blue; */
    /* border-right:80px solid blue; */
}
<div id="main-nav">
</div>
<div id="triangle">
</div>

image

最佳答案

你可以这样做:

CSS

#main-nav {
  position: relative;
  height: 200px;
  width: 1200px;
  overflow: hidden;
  background-color: #D1C5B9;
  z-index: 1;
}

#triangle {
  position: absolute;
  display: block;
  width: 100%;
  background: #3C3C3A;
  height: 40px;
  z-index: 4;
}

#triangle:after {
  position: absolute;
  content: "";
  display: block;
  width: 100px;
  height: 50px;
  transform: rotate(15deg);
  background: #3C3C3A;
  z-index: 4;
  border-radius: 14px;
  left: 50%;
  margin-left: -65px;
  top: 0px;
  border: 1px solid #3C3C3A;
}

#triangle:before {
  position: absolute;
  content: "";
  display: block;
  width: 100px;
  height: 50px;
  transform: rotate(-15deg);
  background: #3C3C3A;
  z-index: 3;
  border-radius: 14px;
  left: 50%;
  margin-right: 0;
  top: 0px;
  border: 1px solid #3C3C3A;
}

HTML

<div id="main-nav">
  <div id="triangle">
  </div>
</div>

注意:根据您的需要进行调整

DEMO HERE

关于html - 带圆 Angular 的倒三 Angular 形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34228769/

相关文章:

html - 如何将图标放在选项卡上并使其出现在网络浏览器的收藏夹(书签)侧

jquery - 无法让 jQuery datepicker tr 类工作

jquery - 嵌套列表悬停行

css - 损坏的 css 背景图像链接在 Safari/Chrome 中显示,在 Firefox 中没有

javascript - Font Awesome CSS 伪元素

javascript - 按下某个键时如何使用 JavaScript/HTML/CSS 加载新页面?

javascript - 在 Angular/Ionic 应用程序中保持标题固定在滚动条上

html - 如何在网页上用JSP标签编写的无序列表应用CSS

javascript - 单击使用 Javascript 后如何使形状改变颜色?

html - 如何修复表中的每一列?