Home > Net >  How to handle directory links in github
How to handle directory links in github

Time:10-27

When using html I need to reference css scripts via the path it has on my hard drive, however, i am not working alone on this project so all my files get cloned into a github repo. (The CSS files are in the repo aswell). Is there anyway to link these so anyone can access it. Because if other people use it on their pc they will probably have another path for the files then i do.

Im still beginner in css and html.

I dont know if its possible to reference github paths or there is an generll approach to referencing paths for everybody

CodePudding user response:

  1. By anyone, do you mean anyone on the Internet? If so, you could publish your repository with GitHub Pages and give people the URL of your .css style sheet (something like: https://yourgithubusername.github.io/nameofyourrepository/style.css).
  1. Otherwise, if by anyone, you mean other contributors to your project/repository, you could simply save your .css file in the same folder as your .html files and use a relative URL. Then, in the head of your HTML pages, put <link rel="stylesheet" type="text/css" href="style.css">. (Replace style.css by the actual name of your style sheet.)

CodePudding user response:

If you put it in the project directory, the development team can use the same git repository to share it. Or using cdn is also a good option

  • Related