html not linking css

后端 未结 8 810
轮回少年
轮回少年 2020-12-21 04:49

I\'m having an issue with linking html and Css and have no idea why. I\'m doing everything like the book and tutorials says. However, I\'m not getting to do the external con

相关标签:
8条回答
  • 2020-12-21 05:23

    If the other suggestions don't work, you can try re-saving the HTML and CSS sheets with "UTF-8" encoding and declare UTF-8 encoding in the HTML under the <head> with <meta charset="utf-8>"

    0 讨论(0)
  • 2020-12-21 05:23

    The rel attribute should just have stylesheet in it, singular not plural as well

    0 讨论(0)
  • 2020-12-21 05:31

    Don't put the / in front of styles.css and make sure they are in the same folder.

    0 讨论(0)
  • 2020-12-21 05:33

    Try this instead:

    <!DOCTYPE html>
    <!-- Language was wrong? -->
    <html lang = "en">
        <head>
            <meta name="viewport" content="width=device-width; initial-scale=1.0">
    
            <title>title</title>
            <meta name="description" content="">
            <meta name="keywords" content="">
    <!-- Check the path to the file - I made it relative to where the HTML is -->
    <!-- Correct the rel attribute's value too -->
            <link rel="stylesheet" type="text/css" href="./styles.css">
        </head>
    
        <body>
            <h1>test</h1>
        </body>
    </html>
    
    0 讨论(0)
  • 2020-12-21 05:38

    If all the above not working:

    1- Make sure you have no inline/internal CSS > Delete all style code from the Html page (it ll prevent external css link)

    0 讨论(0)
  • 2020-12-21 05:39

    I had the same problem correct the correct directory structure solved my problem. This is a good visualiton on how to organize your directory structure.

    http://rosebusch.net/jeff/miscellaneous/tree.html

    That is, the index.html folder is on the same level as the CSS folder. If you want to put index.html in a HTML folder, to link to the CSS folder you would have to backout first by linking href="../css/stylesheet.css". The ".." will take you up a level.

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