如何将HTML文件链接到CSS文件? [英] How do I link my HTML file to my CSS file?

查看:107
本文介绍了如何将HTML文件链接到CSS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个网站,但我似乎无法将我的html文件链接到css文件。



我尝试了什么:



我使用基本的代码行来链接它们但它不起作用。我的css文件名为style.css,它与我的html文件在同一个文件夹中,所以我不知道问题出在哪里。

这是我的html代码:

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>


推荐答案

将所有这一步放回去。

如果您的CSS文件的内容放在您的实际文件中(代替链接),它是否有效?



如果没有看到您的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.



运行你的网站,右键单击并选择查看页面源(如果您使用谷歌浏览器)并单击您为css文件提供的href链接。它应该打开你的CSS文件。如果它加载它意味着你成功加载你的css文件,如果没有,你必须拼写错误的东西或路径必须是不正确的。



你可以做的另一件事是检查天气你的css代码是正确的结构。
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.


< link rel =stylesheettype =text / csshref =style.css>
<link rel="stylesheet" type="text/css" href="style.css">


这篇关于如何将HTML文件链接到CSS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆