为什么引号不能在我的HTML文件中指定类 [英] Why will quotes not work to specify classes in my HTML file

查看:85
本文介绍了为什么引号不能在我的HTML文件中指定类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

css



.task {

颜色:黑色;

text-align:left;

padding-left:25px;

font-size:.875em;

宽度:50%;

位置:相对;

border-style:none;

background-color:white;

}



.task .green {

font-size:.875em;

颜色:#8E8E8E;

}



HTML

< p class =task>< / p> ; 

这是有效的

< p class =task green>< / p> 

这不起作用?在检查器中显示奇怪的字符。嗨!



我尝试了什么:



检查了所有代码尝试了不同的空间组合。

解决方案

删除两个类之间的空格

。task.green 



请参考多个班级/ ID和班级选择器CSS-Tricks [ ^ ]


css

.task {
color:black;
text-align: left;
padding-left:25px;
font-size:.875em;
width:50%;
position: relative;
border-style: none;
background-color: white;
}

.task .green {
font-size: .875em;
color: #8E8E8E;
}

HTML

<p class="task"></p> 

this works

<p class="task green"></p> 

this does not work? Shows up weird characters in inspector. Hep!

What I have tried:

Checked all the code, tried different space combinations.

解决方案

remove the space between two class

.task.green


refer Multiple Class / ID and Class Selectors | CSS-Tricks[^]


这篇关于为什么引号不能在我的HTML文件中指定类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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