can you link a css file through html? - html

I just need some clarification about linking a css file. I am looking at a html widget that has been created by someone and they seem to have a html with a query string to get the required css..
<link href="https://cdnres.willyweather.com.au/widget/cssView.1-12-8.html?id=36723" rel="stylesheet">
And this works if you click on this link
http://cdnres.willyweather.com.au/widget/loadView.html?id=36723
But when i downloaded these files onto my own web server and tried it, it didn't work
http://www.mccdepot.com.au/Test1/loadView.html
but when I update the link styles to a css and updated the file name it worked.
http://www.mccdepot.com.au/Test2/loadView.html
For the query string html do I need to enable something on the server side?
Thanks in advance

i copied that link css add it to your code its coming same as given link i have added the screen shot check it.

try this->
<link rel="stylesheet" type="text/css" href="path of the css file"/>
This is how normally we include a css file in our html page. If still getting error, please check the file path properly.

your linked css file is minified, check it once. When you minify some
css files actually it replaces some variables. Try again to download
again and link it. And js files also not included properly, when it
check it in viewsource file was not found there

Related

How do I use external CSS in an HTML document in VSC?

I'm practicing using HTML in VSC. I want to use external CSS, since I've already figured out inline CSS and internal CSS. However, when I try to use external CSS, the page doesn't change.
I've tried different documents, and I've tried copying the code from documents that already work. I've tried typing the code into different spots etc. But nothing seems to work.
Any ideas why this might be happening? enter image description hereenter image description here
enter image description here
First of all you need to save both the files with .html or .htm extension for html file and .css for css file
Second the path of the css must be correct if both the html and css path are on same directory then code this
<link rel="stylesheet" href="./styles.css">
I think it works if not can you post the screenshot of the directory you are working and the css and html file
Thank You!!!

CSS file is not affecting my HTML or not loading without copying the FULL path

I am trying to link my CSS file to my html file and it is not linking without a Full path. They are on the same level, and I don't get the effect specified in the CSS file. The simple code in CSS is
body { background-color: blue; }
Thank you in advance for your help.
enter image description here
Correct me if I am wrong, but as far as I can see in the screenshot, the HTML and the CSS are not in the same folder. If you want to link to a CSS file that is in a higher directory you should use ../.
In your case, your code should be:
<link rel="stylesheet" type="text/css" href="../../css/styles.css">
Note: Please paste your code in your post instead of making a screenshot, it makes it harder for people to copy / edit things.
It seems you are not in the same directory as your css file. To achieve the desired reult, you will have to go up 2 directories and then access the file through the css folder.

Problem with html and css linking them together

I just started using html and css and I have to do something with it but I am getting the error Unable to open 'style.css'. I don't know what the problem is since the path that I used is the same as the file path.
Make sure the CSS file and the HTML file are in the same folder.
based on your image it should be
href="mywebs\site\style.css"
if you want to link site/style.css to mywebs/smth.html you should go one folder back.
<link href="../site/style.css">
or put the site folder inside mywebs, because based on the picture the site folder is not inside mywebs folder.
Sometimes the file may missed directory. You can close and open the code editor and it will work. Also, make sure your html and css file is in same directory. If you css file is in a different directory then use the following code:
<link type="text/css" href=".../style.css"/>

How to link css external file which is stored on Dropbox?

Not possible link an external CSS file stored in Dropbox with HTML.
Tried and follow up all the instructions I could find online.
That I need to left click and press "Copy Dropbox Link" and that should be by href link but Is not working.
The general dropbox link looks like the the code below
(Changed the ?dl=0 to raw=1 and remove www.dropbox with dl. but still with no luck).
<link rel="stylesheet"
href="https://www.dropbox.com/s/xxxxxxxx/xxx.css">
Could you please check and please point out what I am doing wrong
Thanks
To use this URL in your stylesheet you will need to make a small adjustment to the URL by changing the www. in the URL to dl.
This allows Docs to access the source of the file rather than the Dropbox page for the file.
Finally, your code like this:
<link rel="stylesheet" href="https://dl.dropbox.com/s/xxxxxxxx/xxx.css?dl=0">

adding same style sheet to many html files

I have created a very small personal website with three different pages and one CSS file. I know to embed a CSS file into an html page is the following:
<link rel="stylesheet" type="text/css" href="mystyle.css"/>
but form some reason the CSS file only work in one page. Any advice please
Did you checked your folders structure? You may have other html file in different folders.
I suggest to use an absolute path for your stylesheet. something like:
<link rel="stylesheet" type="text/css" href="/css/mystyle.css"/>
first / in href parameter is what I mean.
Edit: You may use a windows machine and upload your files into a Linux machine. Windows do not care about lowercase or uppercase, but it is important on Linux. rename all your filenames to lowercase every where and use it exactly the same in your code (check your link tags again). this may fix your problem
Sharing the link of the site would be helpful. Make sure that the line of CSS aboves goes on each page. For example, if you have 3 pages with 3 different files: index.htm, bio.htm and contact.htm (I'm having to guess since I have not gotten this info from you). Then make sure the link to the CSS above appears on each of those pages.