Advertisement
Guest User

FontAwesome Perfect Circle + Alignment

a guest
May 6th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. .fa-perfect-alignment() {
  2. border-radius: 50%;
  3. display: inline-block;
  4. text-align: center;
  5. vertical-align: bottom;
  6. }
  7.  
  8. /// Create a circle around a Font Awesome icon
  9. ///
  10. /// @param {Number [unit]} $size
  11. /// The size of the circle
  12.  
  13. .set-circular-size(@size) {
  14. .fa-perfect-alignment();
  15.  
  16. height: @size;
  17. line-height: @size;
  18. width: @size;
  19.  
  20. // Stupid fix for some icons that have weird white space on the top that throws off
  21. // the perfect centering. These are all magic numbers
  22. &.u-tachometer-fix {
  23. line-height: @size - 10px;
  24. }
  25.  
  26. &.u-server-fix {
  27. line-height: @size + 5px;
  28. }
  29.  
  30. .fa-play {
  31. margin-left: 3px;
  32. }
  33. }
  34.  
  35. .circular-fa {
  36. .set-circular-size(65px);
  37.  
  38. color: #FFFFFF;
  39. display: block;
  40. font-size: 40px;
  41. margin-left: auto;
  42. margin-right: auto;
  43.  
  44. &.blue {
  45. background-color: #5473b5;
  46. }
  47. }
  48.  
  49. ----
  50.  
  51. <section class="circular-fa blue">
  52. <i class="fa fa-fw fa-server"></i>
  53. </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement