html not linking css

后端 未结 8 811
轮回少年
轮回少年 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:40

    I invite you to read this article Absolute and Relative Paths

    Then we pass to your code:

    <link rel="stylesheets" type="text/css" href="/styles.css">

    Should be :

    <link rel="stylesheet" type="text/css" href="styles.css">

    Your styles.css should be in the same folder as your html file.

    To verify that you have an error , check Console of your browser,you will be noticed that your file doesn't exist(404 error).

    An other way to make your css working is to integrate it inside your page without separation:

    Example:

     <style type='text/css'>
    
        body {
            background-color:#CCCCCC;
       }
    
        h1 {
            color:#0000EE;
        }
    </style>
    
    0 讨论(0)
  • 2020-12-21 05:40

    Make sure style.css is in your root web directory since that is where you are calling it from

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