Why doesn't my CSS link work?

index.html file

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>PAGINA PRINCIPALA</title>
	**<link rel="stylesheet" type="text/css" href="style.css">**
</head>
<body>
<header>
	<img src="imagini/1.jpg" alt="armenian girl">
	<div id='test'></div>
	<nav></nav>
</header>
<section>
</section>
<footer>
</footer>
</body>
</html>

style.css file

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
/* INCEPUT */
header {
	background-color: #4359a5;
	height: 200px;
	width: 100%;
}
header img {
	margin-top: 10px;
}

I’m trying to create a website loosely based on the first CSS lesson to make sure I can program a website outside of codecademy.com. The HTML sheet works fine but for whatever reason it’s not linking to the css document. The current link is the css file is named style.css both the html and css files are in the same folder. I’m using the Notepad++ text editor to write the code. Any advice I can receive would be much appreciated.

i created both the files, and it works fine.

Are you sure the files are .html and .css? not txt? Right click on the file, and select properties, the window that opens should tell the file type in the bottom, can you upload a screenshot of this? Is it possible for you to upload the files? (through whatever medium you see fit)

1 Like

Indeed, the css file is actually txt. It only has the name “style.css”

eroare

I would had liked to upload the files too but i’m new here and it seems i’m not allowed.

So how can i change the txt to css?

Suggest separate reset.css from the rest of your styles. Your styles.css should only contain page specific style rules for better reading, maintaining and organization.

The Best CSS Reset Stylesheets | Tech Tips

If anything, I would recommend and advise not using reset.css in any of the course material. Until we know the default styles we should not be messing with the default style sheet.

1 Like

All HTML related files are text. Note the MIME Type:

type="text/css"

Just be sure it has the extension, .css.

1 Like

you do know that windows xp is no longer a supported operating system?

Well, i would just create new files, when saving the file, below the file name entry field is a file type option, ensure you select all types (this allows you to set extension/file type in the file name)

1 Like

Made this, still doesn’t work. Could Windows XP be the problem then?

no, windows xp isn’t the problem

did you ensure the files are no longer txt files?

1 Like

No, i selected ‘all files’ when i’ve saved the files but they still appear as text documents

here are the files:

in the top right is a button which you can use to download the files as zip, just extract them

1 Like

Man, thanks a lot! It worked! How did you make it a css file?

I created the file on git.github.com, this allows the file extension in the filename

It should work the same with notepad++ (if you select all files as file type, and then specify the extension (.css) in the filename)

you really need to figure out why its not working, and i can’t help you with that, maybe you can watch a video on youtube?

1 Like

If you are using Notepad to create CSS and HTML files, be sure to set the encoding to UTF-8.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.