小编ald*_*iix的帖子

如何在黑暗模式切换中添加图标

我想在白色圆圈内放置一个图标来表示切换是什么,但我无法让图标显示在正确的位置,更不用说跟随圆圈的位置了。我一直在尝试使用 Font Awesome 图标。

我想要的是

其中任何一个都是我的最终目标,但我仍然很难弄清楚如何使其发挥作用。 用图标切换

我现有的代码

如果有帮助的话,就是我正在开发的网站。

这是CSS

/* Toggle Styles */
.toggle-container {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px
}

.toggle {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  border-radius: 34px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px; …
Run Code Online (Sandbox Code Playgroud)

html css

2
推荐指数
1
解决办法
731
查看次数

标签 统计

css ×1

html ×1