HTML - 是否有必要将对css文件的调用引入引号中? [英] HTML - Is it necessary to enclose a call to the css file into quotes?
问题描述
我有一个.html文件和ist .css文件。我通过指令调用.css。
< link rel = stylesheet href = mystyle.css>
但如果我使用
< link rel =stylesheethref =mystyle.css>
然后在我的页面中没有任何变化。使用引号还是有一些区别?
我相信该规范将其定义为引号,但某些浏览器超出并会知道您的意思。 >
编辑:我错了!来自规范
属性放置在开始标记内,由名称和值组成,由=字符分隔。如果属性值不包含空格字符或任何''`=< or>,则该属性值可以保持不加引号。否则,必须使用单引号或双引号引用该值。值和=字符,如果值为空字符串,可以完全省略。
I have a .html file and ist .css file. I call the .css trough the instruction
<link rel= stylesheet href= mystyle.css>
But if I use
<link rel= "stylesheet" href= "mystyle.css">
then nothing changes in my page. Is there some difference between using the quotes or not?
I believe the spec defines it to have quotes, but some browsers go beyond and will know what you meant.
EDIT: I was wrong! From the spec
Attributes are placed inside the start tag, and consist of a name and a value, separated by an "=" character. The attribute value can remain unquoted if it doesn't contain space characters or any of " ' ` = < or >. Otherwise, it has to be quoted using either single or double quotes. The value, along with the "=" character, can be omitted altogether if the value is the empty string.
这篇关于HTML - 是否有必要将对css文件的调用引入引号中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!