This question already has an answer here:
Why is CSS not applying to HTML?
(1 answer)
Closed 6 years ago.
one of my students has the following code:
<title> Portfolio
</title>
<link rel="stylesheet" type="text/css" src="portfolio1style.css">
</head>
portfolio1style.css is in the same file as HTML file and is definitely spelled correctly.
the CSS works when we put it in the doc internally.
What's going on here?
Thanks
Try to add href="portfolio1style.css" instead of src
You want it to look like this:
<link rel="stylesheet" type="text/css" href="portfolio1style.css">
Switch the src to href
Related
This question already has answers here:
How to link a CSS file from HTML file?
(2 answers)
Closed 26 days ago.
I am trying to link my CSS sheet with the HTML code that I have created in VScode. Below are the screenshots.
HTML snippet
CSS sheet
It looks like there's a slight error in your pathing.
This line here:
<link rel="stylesheet" href="/style.css" type="text/css" />
Should be changed to this:
<link rel="stylesheet" href="style.css" type="text/css" />
Notice the removed / from the .css file path.
When the file your referencing is in the same directory as the file your referencing from, no slashes are needed in the path!
This question already has answers here:
Stylesheet link failure HTML/CSS
(4 answers)
Closed 2 years ago.
I am struggling linking the below html content with css style sheet but could not solve it.
I am using the Atom text editor.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Globe Design Co</title>
<link rel="stylesheet" href="css/style.css">
</head>
Please follow the steps below:
Add <link rel="stylesheet" href="path/to/file.css"/> (replace path/to/file.css with path to css)
Check if the css is in the proper class
Check the path of css file in relation with html.
If you can, please provide the github repo.
This question already has answers here:
Can't get stylesheet to work with ejs for node.js
(5 answers)
Closed 2 years ago.
(Beginner here...)
My CSS won't link to my HTML. I am using GOORM IDE, I have read other questions on this topic and tried the solutions from them but none seem to work (when I apply the CSS inline, it works perfectly), I have so far tried:
Moving the main.css to the same folder as the header.ejs file
Adding type="text/css"
Changing the href to:
main.css
/main.css
/stylesheets/main.css
/public/stylesheets/main.css
../stylesheets/main.css
None of which have worked. Any ideas? I want to keep the CSS in a separate folder if possible. I have included a screenshot of the file structure on GOORM also if that is useful.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js">
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght#0,400;0,700;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="main.css">
mmm I'm not sure really but I think your path based on the image should be
<link rel="stylesheet" href="stylesheets/main.css">
Yes, I also think, there should be the path to the .css-File.
for example, I called my css in the head like this:
<link rel="stylesheet" href="app/css/app.css" />
So you need to call your file:
<link rel="stylesheet" href="public/stylesheets/main.css" />
Btw: is the link to the fonts correct? Is this a valid repository?
Tested in VSCode, this works for me:
You've got your header.ejs in views/partials and your main.css in public/stylesheets.
This means your link has to move up two directories. Use:
<link rel="stylesheet" href="../../public/stylesheets/main.css>
This question already has answers here:
Is it possible to have multiple css files for a single html file (to modularise the style sheets) [duplicate]
(2 answers)
Closed 4 years ago.
I'm new to HTML and I'm trying to href 2 things. I don't get an error, but my style.css sheet doesn't work. Any ideas?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css; style.css">
Do them separately:
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
This question already has answers here:
calling multiple external css files at once to html page
(5 answers)
Closed 7 years ago.
I'm just wondering if there's a way to link multiple css-files to one html-file without having to write down every link like below?
<link rel="stylesheet" type="text/css" href="style/alla.css">
<link rel="stylesheet" type="text/css" href="style/meny.css">
<link rel="stylesheet" type="text/css" href="style/fotografier.css">
<link rel="stylesheet" type="text/css" href="style/footer.css">
You can merge them into one, there are multiple tools to do that:
http://www.shrinker.ch/
https://github.com/zenorocha/browser-diet/wiki/Tools#css