Problem with html and css linking them together - html

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"/>

Related

How CSS file upload to index.html file in Github?

I uploaded index.html and CSS file in githuib pages.
like the images I uploaded.
But I don't know for what reason the CSS didn't load into index.html.
I guess it is because of the problem of the link addresse, but I don't how to fix it.
To make the CSS file to index.html file, how do i fix my codes?
enter image description here
you probably do have some problem with the linking of the css file.
normally css file should be linked between the head tag like this:
<head>
<link rel="stylesheet "href="filename.css">
</head>
to extend on this, if you have deployed your website on github pages, to see the effects there you need to push your changes to github first.
i want to add to Liemannen loop answer,
sometimes we need to add "./" on the css link like this if for some reason the css is not loaded
< link rel="stylesheet" href="./stylesheet.css">

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.

CSS Won't Connect with My HTML

I am doing some HTML & CSS tutorials, and I am unable to get my CSS to appear when I load my web pages.
I linked my CSS to the HTML skeleton.
Can you help me figure out the error?
Screenshot of my HTML document:
Screenshot of my CSS:
Both of the files are stored in the same folder:
If anyone could let me know where I went wrong so I could continue my process, I would appreciate it.
The index.html and the styles.css are in the same folder, so you shouldn't point to a sub-directory for the css. Try this:
<link rel="stylesheet" href="styles.css">
as both index.html and css files are in same folder, you can use
<link rel="stylesheet" href="styles.css?v=1.1.2">
here, v is version declared, so whenever you make changes in your css file, simply change this version numbers to get refresh css and changes to take effect in browser without cleaning caches..
you can also move your css file in stylesheets folder and can keep index.html structure as it is.... basically it is good practice to keep files in subfolders so we can find them easily when searching... for e.g. all .css files in stylesheet folder, all images in images or img folder, all javascripts in js folder...
by the way, what is m.m in css file, in body styling ??

can you link a css file through 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

How can find the image path for css

I am new for for css and Bootstrap so sorry if silly question.
I want to use the Bootstrap in my project. I found a tutorial and going to follow. In the tutorial There is a folder and when I run the index.html file then you can see page with the logo.
I am trying to use the bootstrap and css in my project. I tried make same in my project with main.phtml
I run my file first and I could not see the logo(image) and I was thinking the problem is the path of .css file
The problem is when I put my html file in any directory rather than under main project(no any directory) I cannot see the logo.
Below first two screenshot is the tutorial file screenshots and the second two screenshot is the my file screenshots.
(I did not share any code because the css and html files are working)
Can someone explain to me why we cannot use the html files in directory or if yes how can we manage?
but when I try to add my project I cannot see the logo.
and the view;
EDIT
Please check here:
https://stackoverflow.com/a/20047417/6284581
you do not have to move your .html file
Your example css and img path not state correctly.
../ means one file directory up(check link above)! In your example if you start from
web... then you need to go main project directory. Try this
<link href="../web/static/styles/style.css" rel="stylesheet">
<a class="navbar-brand" href="#"><img src="../web/static/style/img/logo.png"></a>
I hope it will help to you