font awesome animated spinner through background

后端 未结 3 1775
盖世英雄少女心
盖世英雄少女心 2021-02-05 01:07

I am using font awesome spin icon through CSS background for loading the page.

相关标签:
3条回答
  • 2021-02-05 01:30

    You should use fa fa-spinner fa-spin.

    See: Font Awesome Examples

    Example:

    /** CSS **/
    @import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css');
    <!-- HTML -->
    <div class="fa fa-spinner fa-spin"></div>

    0 讨论(0)
  • 2021-02-05 01:36

    Correct answer: Update CSS as given below.

        /* Styles go here */
    .loading-icon {
      position: relative;
      width: 20px;
      height: 20px; 
      margin:50px auto;
      -webkit-animation: fa-spin 2s infinite linear;
      animation: fa-spin 2s infinite linear;
    }
    
    .loading-icon:before {
      content: "\f110";
      font-family: FontAwesome;
      font-size:20px;
      position: absolute;
      top: 0; 
    }
    <!DOCTYPE html>
    <html>
    
    <head>
      <link data-require="fontawesome@*" data-semver="4.5.0" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css" />
      <link rel="stylesheet" href="style.css" />
    </head>
    
    <body>
      <div class="loading-icon"></div>
    </body>
    
    </html>

    0 讨论(0)
  • 2021-02-05 01:43

    Font Awesome 4.7

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    
    <i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
    <i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i>
    <i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>
    <i class="fa fa-cog fa-spin fa-3x fa-fw"></i>
    <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>

    Font Awesome 5+

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
    
    <div class="fa-3x">
      <i class="fas fa-spinner fa-spin"></i>
      <i class="fas fa-circle-notch fa-spin"></i>
      <i class="fas fa-sync fa-spin"></i>
      <i class="fas fa-cog fa-spin"></i>
      <i class="fas fa-spinner fa-pulse"></i>
      <i class="fas fa-stroopwafel fa-spin"></i>
    </div>

    Font Awesome 5 Spinner documentation:

    https://fontawesome.com/how-to-use/on-the-web/styling/animating-icons

    Font Awesome 5 Spinner Icon list:

    https://fontawesome.com/icons?c=spinners

    0 讨论(0)
提交回复
热议问题