Linking CSS File on a HTML Document In Same Directory On my Hard Disk (Windows)

后端 未结 3 1074
一个人的身影
一个人的身影 2021-02-05 15:38

I am using Windows (7) trying to create an offline html page that should link to a separate CSS file located in same directory. I tried to use

         


        
相关标签:
3条回答
  • 2021-02-05 16:04

    Use <link rel="stylesheet" type="text/css" href="./styles.css" /> instead. Note: href="/styles.css" changed to href="./styles.css", which is current directory of your script.

    0 讨论(0)
  • 2021-02-05 16:04

    A general complete answer:

    to address through existing folder, use:

    <link rel="stylesheet" href="./style.css">
    

    to address through parent folder, use:

    <link rel="stylesheet" href="../style.css">
    

    to address through the internet( CDN ) use:

    <link
      rel="stylesheet"
      href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3./css/bootstrap-theme.min.css"
      >
    

    to address through your hard drive use:

    <link rel="stylesheet" href='file:///C:/mystyles.css'>
    
    0 讨论(0)
  • 2021-02-05 16:11

    try this one, it worked for me.

     <link rel="stylesheet" href="./main.css">
    
    0 讨论(0)
提交回复
热议问题