首页前端开发HTMLhtml五角星设置

html五角星设置

时间2023-11-12 01:53:03发布访客分类HTML浏览320
导读:HTML五角星设置方法* { margin: 0; padding: 0;}.star { position: relative; width: 0; height: 0; border-right: 50px so...

HTML五角星设置方法

* {
       margin: 0;
       padding: 0;
}
.star {
       position: relative;
       width: 0;
       height: 0;
       border-right: 50px solid transparent;
       border-bottom: 35px solid #ffcc33;
       border-left: 50px solid transparent;
       transform: rotate(35deg);
       margin: 50px 0;
}
.star:before {
       position: absolute;
       content: "";
       width: 0;
       height: 0;
       left: -50px;
       top: 0px;
       border-right: 50px solid transparent;
       border-bottom: 35px solid #ffcc33;
       border-left: 50px solid transparent;
       transform: rotate(-70deg);
}
.star:after {
       position: absolute;
       content: "";
       width: 0;
       height: 0;
       top: 13px;
       left: -65px;
       border-right: 50px solid transparent;
       border-bottom: 35px solid #ffcc33;
       border-left: 50px solid transparent;
       transform: rotate(-35deg);
}
    

以上是可以用来实现HTML五角星的代码。通过设置border的不同宽度和颜色,可以实现不同颜色和大小的五角星。同时,可以通过transform属性实现旋转效果。以上代码均是用CSS来实现的,可以在HTML文件中嵌入CSS,或者将其存为单独的CSS文件。

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: html五角星设置
本文地址: https://pptw.com/jishu/535321.html
html代码说明书 css怎么做第三方登录

游客 回复需填写必要信息