css - 使用纯 css 创建 'wing' Angular 技巧

标签 css css-shapes rounded-corners

<分区>

是否可以像这张图片一样添加 Angular (顶 Angular )?我不确定这种效果叫什么。如果是,您的方法是什么?

更新: 有人建议这个问题是重复的,不幸的是,重复的解决方案没有考虑到“翅膀”是用颜色填充的。虽然它非常适合具有轮廓的选项卡,但它具有实际填充。

这种技术叫什么?

Weird corner trick

最佳答案

我的方法是使用 :before:after 伪类来添加和定位 Angular 尖。

.box {
  position: absolute;
  background: gray;
  width: 400px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 0 0 10px 10px;
}

em {
  display: block;
  font-style: italic;
  font-size: 1.1em;
  color: white;
  text-align: center;
  margin: 0 auto;
  width: 100%;
  line-height: 2.2em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}

.box:before,
.box:after {
  content: '';
  display: block;
  border: 10px solid transparent;
  border-top: 10px solid gray;  
  position: absolute;
  top: 0;
}

.box:before {
  left: -6px;
}

.box:after {
  right: -6px;
}
<div class="box">
  <em>Benefits Included In Members Savings Package</em>  
</div>

关于css - 使用纯 css 创建 'wing' Angular 技巧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37040553/

上一篇:css - 如何在 CSS 中打断单词时在单词末尾设置断字?

下一篇:html - 无法将 CSS 文件连接到 HTML 文件

相关文章:

javascript - 标准模式下 IE8 的 jQuery 圆 Angular 代码?

CSS 圆 table Angular ,渐变背景

html - 列表 <ul> 中的更多行和垂直居中对齐

css - 当轮廓样式为自动时,轮廓偏移不会应用于 Chrome/Windows

html - 如何使用div绘制曲线?

html - 流体宽度 SVG 形状上的重复图案?

css - youtube 嵌入式视频作为带边框半径的 iframe

jquery - 如何停止无样式内容的闪现

jquery - 使用 jquery 检查 css 底部

html - 使用 CSS 创建形状后,如何将其中心用作另一个 CSS 形状的焦点?