search

Home  >  Q&A  >  body text

How to correctly assign paths linking HTML files and CSS files?

<p>So I have a folder on my desktop called "Project 1" with two other folders in it, one called "HTML" which has my HTML files in it and another called "CSS" , which contains my CSS files. How to link HTML file to CSS with pathname? </p>
P粉926174288P粉926174288495 days ago535

reply all(1)I'll reply

  • P粉350036783

    P粉3500367832023-09-04 11:18:27

    reh!

    If this is your folder structure:

    Project 1
     |-- HTML
     |   |  index.html
     |
     |-- CSS
     |   |  style.css

    Then in index.html you need to link it like this:

    <link href='../CSS/style.css' rel='stylesheet' />

    This is a relative path, so starting from index.html you have to go up one level (../) and go into the CSS folder ( CSS/) and select the file (here style.css).

    reply
    0
  • Cancelreply