引用CSS类 [英] Referencing a CSS Class

查看:95
本文介绍了引用CSS类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我写一个css文件来操纵我的导航栏。 HTML代码如下:

So I'm writing a css file to manipulate my navigation bar. The HTML code is as such:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>Designs by Dante</title>
<link rel="stylesheet" type="text/css" href="style.css"   />
</head>

<body>

<h2>Designs by Dante</h2>

<ul id="navigation">
<li><a href="www.designsByDante.com/homepage.html">Home</a></li>
<li><a href="www.designsByDante.com/about.html">About</a></li>
<li><a href="www.designsByDante.com/services.html">Services</a></li>
<li><a href="www.designsByDante.com/portfolio.html">Portfolio</a></li>
<li><a href="www.designsByDante.com/contact.html">Contact</a></li>
</ul>

</body>

</html>

很简单。我用导航类做了无序列表,所以我可以在所有五个网页上操作它。

Pretty simple. I made my unordered list with the class of navigation so I can manipulate it the same across all five webpages.

但是,我创建了一个style.css文件文件夹作为五个.html文件,它不从任何绘图。好吧,差不多。

However, I created a style.css file in the exact same folder as the five .html files and it doesn't draw from that whatsoever. Well, almost.

这里是CSS文件代码:

Here's the CSS file code:

#navigation
{
margin:50px;
padding:0;
list-style:none;
width:525px; 
}



我知道你必须从.css文件中使用HTML但是在.css文件中有一些东西,以使它可以被HTML识别,而不只是正确命名它并链接它?

I know you have to draw from the .css file using the attribute within the HTML but is there something in the .css file to make it recognizable by the HTML other than just naming it correctly and linking it?

我玩这个, m正,它不是.css文件。这个结论的原因是因为我改变#navigation的.css文件为ul和presto ...它的工作。

I played around with this and I'm positive it isn't the .css file. The reason for that conclusion is because I changed #navigation on the .css file to ul and presto...it worked.

下一步是确保我正确地写入,给定上面的代码,我认为是正确的。我昨晚研究了CSS,因为我之前的问题不可避免地没有以前的研究。但我真的卡住了,会爱一个人启迪我,我做错了。我现在将继续浏览w3schools.com网站。感谢您花时间阅读此邮件!

Next step was to make sure I was writing it correctly which, given the above code, I think is correct. I researched CSS heavily last night because my previous question was admittedly done with no previous research. But I am truly stuck and would love someone to enlighten me as to what I'm doing wrong. I'm going to continue going through the w3schools.com website for now. Thank you for taking the time to read this message!

推荐答案

您正在使用 LEFT DOUBLE QUOTATION MARK )和正确的双重报价标记),您应该使用 QUOTATION MARK )(或 APOSTROPHE '))。

You are using LEFT DOUBLE QUOTATION MARK (") and RIGHT DOUBLE QUOTATION MARK (") where you should be using QUOTATION MARK (") (or APOSTROPHE (')) around your id attribute value.

由于这些不是有效的分隔符属性值,它们被视为

Since those are not valid delimiters for an attribute value, they are treated as part of the id.

这将被验证器

这篇关于引用CSS类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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