Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to create a website but I can't seem to link my html file to the css file.

What I have tried:

I used the basic line of code to link them but it is not working. My css file is called style.css and it is in the same folder as my html file so I do not get where the problem is.
Here is my html code:
<!DOCTYPE html>
<html>
	<head>
		<title>Fashion closet website</title>
		
		<link rel="stylesheet" type="text/css" href="style.css"/>
	
	
	
	</head>
	<body>
		<header>
		<div class="row">
			<div class="logo">
			<img src="logo.jpg"
			</div>
		<ul class="main-nav">
			<li class="active"><a href=""<li><a href=""> HOME </a></li>
			<li><a href=""> SERVICES </a></li>
			<li><a href=""> ABOUT </a></li>
			<li><a href=""> CONTACT </a></li>
			<li><a href=""> NEWS </a></li>
			<li><a href=""> FAQ </a></li>
			
		</ul>
		
		</div>
		
		<div class="pinky">
		<h1>ALL YOU CAN WEAR</h1>
			<div class="button">
				<a href="" class="btn btn-one"> Open closet</a>
				
			</div>
		</div>
	
	
	
	
	
	
	</header>
		
		
		
	
	
	</body>








</html>
HTML

Posted
Updated 2-Jul-18 19:25pm
Comments
[no name] 11-Jun-18 4:52am    
That's the correct way, so the problem must be somewhere else. Does your server allow access to the file?
Jochen Arndt 11-Jun-18 5:06am    
Looks OK besides the missing space in front of the slash for the self closing link tag.
Mohibur Rashid 11-Jun-18 6:28am    
Can you access http://localhost/style.css

Take all of this one step further back.
If the content of your CSS file were place in your actual file (in place of the link), does it work?

Without seeing your CSS file content, we can only hope it is correctly formatted. Not only the content of your classes, but the file, itself.


 
Share this answer
 
Run Your Website , right click and select "View Page Source" (if u r using google chrome) and click on the href link you provided for your css file. it should open your css file. if it loads it means u successfully loaded ur css file and if not, u must be misspelled something or path must be incorrect.

Another thing you can do is that Check weather your css code is in proper structure.
 
Share this answer
 
<link rel="stylesheet" type="text/css" href="style.css">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900