html - div 左上角/右下角的斜 Angular

标签 html css css-shapes

Slanted corners on top-left / bottom-right sides of div

我们如何在纯 CSS 中创建这个形状?

最佳答案

你可以像下面这样:

html

<div class="topleft">
    <div class="buttomright"></div>
</div>

and the css

div {
    height: 300px;
    background: silver;
    position: relative;
}
.topleft:after {
    content:'';
    position: absolute;
    top: 0;
    left: 0;

    border-top: 80px solid white;
    border-right: 80px solid silver;
    width: 0;
}

    .buttomright:before {
        content:'';
        position: absolute;
        bottom: 0;
        right: 0; 
        border-bottom: 80px solid white;
        border-left: 80px solid silver;
        width: 0;
    }

请参阅JSFiddle

关于html - div 左上角/右下角的斜 Angular ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23486821/

相关文章:

javascript - 如果不存在合适的 ARIA 属性,我是否应该使用自定义 ARIA 属性?

javascript - 在我的代码中创建一个登录窗口

jquery - javascript 没有在 flask 中加载管理模板

html - 网站 build 中的 iPad 缩放问题

html - 如何使用 CSS 制作人字形箭头?

javascript - 如何使用 iframe 和 css 打印网页

ruby-on-rails - Rails 3 和 HTML 5 微数据

css - 如何使 CSS 六边形居中

html - 如何用边界边上的链接创建一个圆

css - 使用 onclick 更改 div 中的价格