Html div有ID和class,但class没有';我不申请离婚
我有下面这个简单的html/css代码。 当我在“welcome”类中尝试更改字体大小时,它实际上不会在div中的任何内容上应用字体大小、背景色、字体重量等 我能解释一下为什么会发生这种情况吗。DIV本身有一个ID和类Html div有ID和class,但class没有';我不申请离婚,html,css,Html,Css,我有下面这个简单的html/css代码。 当我在“welcome”类中尝试更改字体大小时,它实际上不会在div中的任何内容上应用字体大小、背景色、字体重量等 我能解释一下为什么会发生这种情况吗。DIV本身有一个ID和类 <html> <head> <style> .welcome { font-weight: bold; font-size: 50%; font-style: oblique; background-color:
<html>
<head>
<style>
.welcome {
font-weight: bold;
font-size: 50%;
font-style: oblique;
background-color: yellow;
}
a:hover {
font-size: 500%;
}
#greeting {
position: absolute;
top: 200px;
left: 100px;
text-align: left;
}
p {
color: green;
}
</style>
</head>
<body>
<div id="greeting" class=”welcome”>
Sample Text
<p>Thank you for coming here!</p>
<p>Welcome to <a href=”ltu.html”>La Trobe</a></p>
<p>Thank you for coming here!</p>
</div>
</body>
</html>
.欢迎{
字体大小:粗体;
字体大小:50%;
字体风格:斜体;
背景颜色:黄色;
}
a:悬停{
字体大小:500%;
}
#问候语{
位置:绝对位置;
顶部:200px;
左:100px;
文本对齐:左对齐;
}
p{
颜色:绿色;
}
示例文本
谢谢你来这里
欢迎来到
谢谢你来这里
我想你可能是从某个地方复制了代码,
您使用的引号不正确
而不是
class=”welcome”
应该是
class="welcome"
(与代码的其他部分相同)尝试使用单引号(')而不是双引号(“)。这似乎就是问题所在。您使用了错误的字符来定义类,请使用双引号或单引号,如下所示
<div id="greeting" class=”welcome”><!--This is incorrect-->
<div id="greeting" class="welcome"><!--Use this-->
<div id="greeting" class='welcome'><!--Or this one-->
如果你在课堂上使用“
字符,请使用简单的”
或“
”,这样做会很好,同样,你的主播的hrefQuestion投票结果很接近,因为这个问题是由一个简单的印刷错误引起的。复印机的诅咒:D@invissible现在一切都好了:-)