css 实现wifi,gprs 信号

2 篇文章 0 订阅

1、wifi信号实现

        <div class="box">
          <div class="wifi-symbol">
            <div class="wifi-circle first"></div>
            <div class="wifi-circle second"></div>
            <div class="wifi-circle third"></div>
            <div class="wifi-circle fourth"></div>
          </div>
        </div>

css 样式

.box {
  position: relative;
  width: 240px;
  height: 240px;
}
.wifi-symbol {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transform: rotate(45deg);
  position: absolute;
  top: -30%;
}
.wifi-circle {
  border: 20px solid #ccc;// 根据box高度宽度设置 border宽度,根据几个信号改变border颜色
  border-radius: 50%;
  position: absolute;
}
.first {
  width: 140%;
  height: 140%;
  top: 30%;
  left: 30%;
}
.second {
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
}
.third {
  width: 60%;
  height: 60%;
  top: 70%;
  left: 70%;
}
.fourth {
  width: 15%;
  height: 15%;
  top: 90%;
  left: 90%;
}

2、gprs信号

      <ul class="gprs">
        <li
          style="height: 0.4rem"
          class="bg-gray"
        ></li>
        <li
          style="height: 0.7rem"
          class="bg-gray"
        ></li>
        <li
          style="height: 1rem"
          class="bg-gray"
        ></li>
        <li
          style="height: 1.3rem"
          class="bg-gray"
        ></li>
      </ul>

css样式

.gprs {
  height: 1.5rem;
  width: 2rem;
  line-height: 1.5rem;
  display: flex;
  align-items: end;
  margin: 0;
  list-style: none;
}
.gprs > li {
    width: 4px;
    margin-left: 0.2rem;
    border-radius: 5px;
  }
.bg-gray {
    background-color: #8799a3;
}

.bg-green {
    background-color: #39b54a;
}

 

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
可以使用CSS3中的伪元素和渐变来实现WiFi信号形状。 首先,我们需要为WiFi信号创建一个div容器,并将其设为相对定位。 ```html <div class="wifi-signal"></div> ``` ```css .wifi-signal { position: relative; width: 40px; height: 40px; } ``` 接下来,我们要使用伪元素来创建信号条。每个伪元素都是一个矩形,使用CSS渐变来生成线性渐变效果。 ```css .wifi-signal::before, .wifi-signal::after { content: ""; position: absolute; bottom: 0; width: 5px; height: 15px; background: linear-gradient(to top, #fff, #ccc); } ``` 接着,我们需要将伪元素放置在正确的位置上。我们可以使用left属性来定位第一个信号条,然后使用右侧的伪元素来放置其他信号条。 ```css .wifi-signal::before { left: 0; } .wifi-signal::after { right: 0; } .wifi-signal::after::before { right: 10px; } .wifi-signal::after::after { right: 20px; } ``` 最后,我们需要使用border-radius属性来将信号条的角度进行圆滑处理,从而创建一个WiFi信号形状。 ```css .wifi-signal::before, .wifi-signal::after { border-radius: 2px; } .wifi-signal::before { border-radius: 2px 2px 0 0; } .wifi-signal::after { border-radius: 0 0 2px 2px; } ``` 完整的CSS代码如下: ```css .wifi-signal { position: relative; width: 40px; height: 40px; } .wifi-signal::before, .wifi-signal::after { content: ""; position: absolute; bottom: 0; width: 5px; height: 15px; background: linear-gradient(to top, #fff, #ccc); border-radius: 2px; } .wifi-signal::before { left: 0; border-radius: 2px 2px 0 0; } .wifi-signal::after { right: 0; border-radius: 0 0 2px 2px; } .wifi-signal::after::before { right: 10px; } .wifi-signal::after::after { right: 20px; } ``` 这样,我们就可以使用CSS3来创建一个漂亮的WiFi信号形状。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

少十步

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值