css – 带有Font Awesome 5图标的复选框

前端之家收集整理的这篇文章主要介绍了css – 带有Font Awesome 5图标的复选框前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

有人已经设计了带有字体真棒5个图标的复选框吗?

我已经用谷歌搜索了它,发现只有像http://flatlogic.github.io/awesome-bootstrap-checkbox/demo/这样的FA-4的例子

我更新到FA5并使用CSS伪元素运行其他东西,但在复选框内它没有运行.我对没有伪元素的其他解决方案持开放态度.

提前致谢!

小提琴,例如:

Fiddle with FA-4.7

  1. /* CheckBoxes */
  2. .checkBox input[type="checkBox"] {
  3. display: none;
  4. }
  5. .checkBox label {
  6. padding-left: 0;
  7. }
  8. .checkBox label:before {
  9. content: "";
  10. width: 20px;
  11. height: 20px;
  12. display: inline-block;
  13. vertical-align: bottom;
  14. margin-right: 10px;
  15. line-height: 20px;
  16. text-align: center;
  17. border: 1px solid #ccc;
  18. Box-shadow: inset 0 1px 1px rgba(0,0.075);
  19. font-family: "FontAwesome";
  20. }
  21. .checkBox input[type="checkBox"]:checked+label::before {
  22. content: "\f00c";
  23. }
  1. Box">
  2. Box" id="profile_notifications" value="" checked/>

Fiddle with FA-5

  1. /* CheckBoxes */
  2. .checkBox {
  3. padding-left: 10px;
  4. padding-top: 10px;
  5. }
  6. .checkBox input[type="checkBox"] {
  7. display: none;
  8. }
  9. .checkBox label {
  10. padding-left: 0;
  11. }
  12. .checkBox label:before {
  13. content: "";
  14. width: 20px;
  15. height: 20px;
  16. display: inline-block;
  17. vertical-align: bottom;
  18. margin-right: 10px;
  19. line-height: 20px;
  20. text-align: center;
  21. border: 1px solid #ccc;
  22. Box-shadow: inset 0 1px 1px rgba(0,0.075);
  23. font-family: "Font Awesome 5 Solid";
  24. }
  25. .checkBox input[type="checkBox"]:checked+label::before {
  26. font-family: "Font Awesome 5 Solid";
  27. content: "\f00c";
  28. }
  29. .test {
  30. padding-left: 10px;
  31. padding-top: 10px;
  32. }
  33. .test .pseudo-element:before {
  34. display: none;
  35. font-family: "Font Awesome 5 Solid";
  36. content: "\f00c";
  37. }

猜你在找的CSS相关文章