Home > Software design >  Unable to load home icon in html code using font-awesome
Unable to load home icon in html code using font-awesome

Time:03-19

<!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>WEbsite</title>
    
        <link rel="stylesheet" href="css/style.css" />
        <link
          rel="stylesheet"
          href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css"
        />
      </head>
    
      <body>
        <header >
          <nav >
              <a href="#home"><i ></i>  <span>home</span></a>
          </nav>
        </header>
      </body>
    </html>

Unable to load home icon in html code using font-awesome. In place of home icon, browser showing a cross icon. Kindly, tell me what's wrong with the code?

CodePudding user response:

Use fa-solid instead of regular.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>WEbsite</title>

  <link rel="stylesheet" href="css/style.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css" />
</head>

<body>
  <header >
    <nav >
      <a href="#home"><i ></i>  <span>home</span></a>
    </nav>
  </header>
</body>

</html>

CodePudding user response:

The Fontawesome icon is loaded fine, but you're using the wrong classes. Replace to

  • Related