For the index file
<link rel="stylesheet" href="css/stylesheet.css"/>
That works fine no problem here though.
The rest of my html documents are in a folder called "pages". Here though it cant find my CSS sheet. I tried
<link rel="stylesheet" href="../oliverteglhus.dk/css/stylesheet.css"/>
Does not work. Sorry for this noob question. It's just bugging me.
it should be:
<link rel="stylesheet" href="../css/stylesheet.css"/>
If the rest of your documents are in a folder that is in the same directory as your index file, then you only need to go up one directory to find your CSS file:
<link rel="stylesheet" href="../css/stylesheet.css"/>
So, if your directory structure looks like this:
-index.html
-pages
page1.html
page2.html
etc...
-css
stylesheet.css
To load the stylesheet.css from CSS folder in page1.html, you have to use like
<link rel="stylesheet" href="../css/stylesheet.css"/>
Check this answer for a more detailed explanation
Related
I need some help here.. I tried different links but it does not load the CSS file..
<link rel="stylesheet" type="text/css"
href="https://github.com/cengizkirazjs.github.io/cengizkiraz.github.io/styles.css">
This is the page and the outcome: https://cengizkirazjs.github.io/cengizkiraz.github.io/
Any advice? Its my first time linking CSS with HTML on Github!
As it was said in the comments, what do you think about changing file path a bit?
In your code we have this line
<link rel="stylesheet" type="text/css" href="cengizkiraz.github.io/styles.css">
It contains an absolute path. If you want to stick to this method, maybe just add a protocol, like this
<link rel="stylesheet" type="text/css" href="https://cengizkiraz.github.io/styles.css">
But it would be better if you use relative paths
In this case, our <link> will look like this
<link rel="stylesheet" type="text/css" href="styles.css">
It means that HTML will search for this file in folder, where .html file is saved. Looks slightly better, doesn't it?
I have created a few html-pages and one CSS-page inside a folder (Webservice). At first I just used to reference to my CSS-page like this because they were in the same folder.
<link rel="stylesheet" href="style.css">
Then I wanted to make it look more clean so I created separate folders for html and CSS within the already existing folder (Webservice). The new folders were named html and CSS. If I do it like down below it works, but I need to be able to access the files on other computers/devices as well.
<link rel="stylesheet" href="file:///Users/home/Desktop/Webservice/css/style.css">
It does not work to do like this:
<link rel="stylesheet" href="css/style.css">
How do I solve this?
You will have to use ../ inside the html folder to go to the parent folder.
And then you can access the css folder so your link will look like this:
<link rel="stylesheet" href="../css/style.css">
By using a relative path, it will work on your other computer.
You have to set the relative path to your CSS style from HTML file.
To view more https://desktop.arcgis.com/en/arcmap/10.3/tools/supplement/pathnames-explained-absolute-relative-unc-and-url.htm
I have linked the w3.css stylesheet in my html (as suggested at w3schools) to utilize their responsive template but it doesn't appear to be working. I have linked it as such within the head tag of my html:
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="w3-theme-brown.css">
Am I missing something?
Make sure your CSS code is in your .css file, and your HTML and CSS files are in the same directory if you are using <link href="File.css" rel="stylesheet"> and not writing the directory.
Also, don't forget to put your link tags between opening and closing head tags.
It should look like the example I posted below.
If it's still not loading then it would to do with the location of your stylesheets(css).
Example - href="path/to/stylesheet"
The path would start from the current directory your HTML is in... so if you had index.html in the root directory and your css files a sub-directory then the example would look like this.
Example - href="css/w3.css"
Example - href="css/w3-theme-brown.css"
//HTML
<head>
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="w3-theme-brown.css">
</head>
I've using bootstrap and file and folders is like this
root/css/..
When I include <link id="bs-css" href="css/bootstrap.min.css" rel="stylesheet"> it is working for files in root folder. But if I have file in another folder and trying to include css doesn't work. It doesn't show any style. For example
root/users/profile.php
then I include in profile.php like this
<link id="bs-css" href="../css/bootstrap.min.css" rel="stylesheet">
I've also tryed full path again didn't work properly. But if I put inside /users/ css file or full folder is working href="css/bootstrap.min.css"
You can change the link to be the full path from your URL like this:
<link id="bs-css" href="yoursite.com/css/bootstrap.min.css" rel="stylesheet">
That should work from any page.
Try using href="/css/bootstrap.min.css" This should work no matter where your php or html file is located. This is called a relative path. So..
<link id="bs-css" href="/css/bootstrap.min.css" rel="stylesheet">
As long as css is a direct child of the root, this should find it.
I was linking my external css file to the header of my page, like this
<head>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
</head>
But the styling wasn't working until I added a dot to the path, like this
<head>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
</head>
I have tried it in Firefox, Chrome, Mozilla and Opera and everywhere was the same result.
How can this be possible? Since in all the sites I have searched, they indicate that to go up to the root folder you just need to type "/css/style.css" without a dot.
Thank you in advance for your time.
It always depends in which folder you css file is. if you have a structure like this:
-index.html
-css (folder)
--style.css
than you can write css/style.css, but if it is like this
-pages (folder)
--index.html
-css (folder)
--style.css
than you have to add a ./css/style.css because "./" means to get a folder back bevore entering the css folder
The . mean's
one folder back/[path]
normaly u write ../[path]
EDIT:
i dont know how your Folder architektur look's like, and if you using JQuery or Javascript for loadin's that's important informations..