Search code examples
htmlcssdirectorystylesheetroot

Linking my stylesheet without the root so can use the folder anywhere


I linked my stylesheet customstyle.css to my index.html but when i copy the folder to another drive the stylesheet wont get linked how do i overcome this problem as i have to send the folder to another person

<link rel="stylesheet" type="text/css" href="D:\healthplus\style.css">

Solution

  • Make sure that index.html and customstyle.css are in the same folder. Then in index.html you should link to your stylesheet like this:

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

    This is a relative path because it doesn't start with a /