Home > Net >  Why CSS is not working on my github pages?
Why CSS is not working on my github pages?

Time:01-13

I'm trying to deploy my react app on github as pages but the css isn't working. Im attaching my github repository if anyone can help.text.

As right now the page is looking totally messed cause not css is applied.

CodePudding user response:

From your HTMl: <link font-family: "Montserrat", sans-serif; href="https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=swap" rel="stylesheet" />

take out font-family: "Montserrat", sans-serif; That would go in your CSS file.

It should read as

<link href="https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=swap" rel="stylesheet">

I hope this helps! If you still have issues, let me know. Cheers.

CodePudding user response:

cLooking at generated index.html file in the gh-pages branch, I can see that the file is malformed; you have missing closing tags in your HTML.

// index.html (I added newlines for readability)
<!doctype html>
  <html lang="en">
    <head>
      <meta charset="utf-8"/>
      <link>font-family: "Montserrat", sans-serif; href="https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=swap" rel="stylesheet"
      <link>rel="stylesheet" href="./styles.css"
    ...

Notice the link tags aren't closed. Because of this, the CSS file will not be loaded by the browser.

  • Related