html - 如何使用 CSS 创建三 Angular 形背景

标签 html css font-awesome

我有以下 html block

<div class=""header>
    <i class="icon-star"></i>
    <h1>some text goes here</h1>
</div>

和这些CSS样式

h1 {
    display: inline-block;
}
i {
    display: inline-block;
    width: 0px;
    height: 0px;
    border-style: solid;
    border-width: 200px 0 0 200px;
    border-color: transparent transparent transparent red;

}

而且我正在使用 fontawesome 图标字体。我想要实现的是这个 enter image description here

这是我试过的jsfiddle .我完全没有做到这一点。有人可以帮助我吗?

最佳答案

您已经在 html 中使用了 h1,在 css 中使用了 h2!

这可能有帮助

h1 {
    margin: -130px 0 0 200px;
}
i {
    display: inline-block;
    width: 0px;
    height: 0px;
    border-style: solid;
    border-width: 200px 0 0 200px;
    border-color: transparent transparent transparent red;
}

fiddle

关于html - 如何使用 CSS 创建三 Angular 形背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18652687/

相关文章:

css - 如何为 Font Awesome svg 图标添加阴影?

javascript - 在 Javascript 中将 Font Awesome 附加到表格

html - inline-block 默认垂直对齐

html - 文本不环绕 div

javascript - 使用 Javascript 隐藏货币开关上显示的文本

css - 使用 Font Awesome 图层在圆圈内渐变

html - 没有设置高度的CSS SlideIn动画

html - 从 html 链接在移动设备上打开应用程序

javascript - 在不同的浏览器和设备上呈现不同的 HTML

python - 在 Flask : Overriding "static system" 中使用 CSS 模板