html+css3实现div右上角斜三角删除

戏子无情 提交于 2019-12-18 16:10:18

html 部分:

        <div class="box">
            <div>
                otherthings
            </div>
            <div class="box-con">
                <span>×</span>
            </div>
        </div>

        <div class="box">
            <div>
                otherthings
            </div>
            <div class="box-con">
                <span>×</span>
            </div>
        </div>

        <div class="box">
            <div>
                otherthings
            </div>
            <div class="box-con">
                <span>×</span>
            </div>
        </div>

css部分:

          .box{
            width:180px;
            height:100px;
            position:relative;
            background: white;
            overflow: hidden;
            border: 1px solid #cccccc;
          }
        .box .box-con{
            width:60px;
            height:60px;
            position: absolute;
            background: red;
            top:-30px;
            right:-30px;
            transform: rotate(45deg);
          }
        .box .box-con span{
            position: absolute;
            bottom:0;
            display: block;
            width:60px;
            text-align: center;
            transform: rotate(-45deg);
        }

效果图:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!