首页 前端知识 css 绘制直角梯形 和 平行四边形

css 绘制直角梯形 和 平行四边形

2024-09-10 23:09:39 前端知识 前端哥 151 846 我要收藏

                <div
                  :class="{
                    isFirst: index === 0,
                    tab_item: index !== 0,
                  }"
                  :style="{
                    width: item?.label?.length > 4 ? '206px' : '137px',
                  }"
                >
                  <div>
                    {{ item.label }}
                  </div>
                </div>

isFirst是直角梯形 tab_item是平行四边形 

直角梯形

        

                .isFirst
                    cursor pointer
                    width: 107px;
                    height: 0px;
                    border: 0px solid transparent
                    border-bottom: 42px solid $background;
                    border-right: 42px solid transparent
                    display: flex
                    justify-content: center
                    div
                        position: relative
                        top: vh(12)
                        left: vw(5)

 平行四边形

                .tab_item
                    cursor: pointer;
                    width: 137px;
                    height: 100%;
                    background-color: $background;
                    position: relative;
                    transform: skew(46deg);
                    display: flex
                    justify-content: center
                    align-items: center
                    left: vw(-15)
                    margin-right: vw(5)
                    div
                        transform: skew(-46deg);

转载请注明出处或者链接地址:https://www.qianduange.cn//article/18043.html
标签
评论
发布的文章

关于HTML的知识

2024-09-18 23:09:36

js简单实现轮播图效果

2024-09-18 23:09:36

CSS3美化网页元素

2024-09-18 23:09:27

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!