好吧,我真的很新。几个小时前,我将样式类“ P”设置为
...// <Style>
P {color:black, font-size: 16pt;}
...// </Style>
而且我认为它可能已经损坏了一些东西!我所有其他代码行都可以正常运行,但是这一行!我以为它会使每个默认的新段落变成16pt黑色...但是它不能让我改变颜色。
.need1类未正确调用,并显示为黑色16pt的先前设置,而不是居中的24pt红色粗体文本的.need1类。
而且,Jfiddler一直告诉我
</P>
因为关闭是不适当的,所以我将它们移开了,但我应该放回去吗?我已经尝试过两种方法,但都不能解决问题。
<STYLE>.
.red1 {color: #ff0000}
.orange1 {color: }
.blue1
.green1
.need1 {font-size:24pt; color:red; font-weight: bold; text-align:center}
.need2 {font-size:16pt; color:red;}
.want {font-size:16pt; color:orange}
.fun {font-size:14pt; color:green}
.cata {font-size:20pt; color:black; font-weight: bold; text-decoration:underline; text-align: left}
.specs1 {font-size:20pt; color:blue; font-weight:bold; text-align:center; text-decoration: underline}
.specs2 {font-size:16pt; color: blue; text-align:center}
.head {font-size:28pt; color:purple; text-align:center;
text-decoration:underline; font-weight: bold}
.ex {font-size: 18; color:black; text-align: right}
a:link {color:blue; background-color:transparent; text-decoration:none}
a:visited {color:purple; background-color:transparent; text-decoration:none}
a:hover {color:red; background-color:transparent; text-decoration:underline}
a:active {color:yellow; background-color:transparent; text-decoration:underline}
</STYLE>.
<P Class = "head"> TEXT
</P>
<P Class = "need1"> TEXT
<BR>TEXT <span Class = "red1">TEXT</span> TEXT
<BR>TEXT
<BR>
<BR>TEXT
<P Class = "cata">
TEXT
</P>
<P>
<BR>TEXT = <span class= "red1">RED</span>
<BR>TEXT = ORANGE
<BR>TEXT =
<P Class = "head">
TEXT[Jfiddle Screencapture][1]
</P>
最佳答案
尝试使用!重要
P {color:black !important; font-size: 16pt !important;}
但首先您必须更正代码中的错误,例如:为什么要写“。”样式之后,则必须写“;” CSS之间的属性不是“。”
修复后的代码
P {color:black !important; font-size: 16pt !important;}
.red1 {color: #ff0000}
.orange1 {color: }
.blue1
.green1
.need1 {font-size:24pt; color:red; font-weight: bold; text-align:center}
.need2 {font-size:16pt; color:red;}
.want {font-size:16pt; color:orange}
.fun {font-size:14pt; color:green}
.cata {font-size:20pt; color:black; font-weight: bold; text-decoration:underline; text-align: left}
.specs1 {font-size:20pt; color:blue; font-weight:bold; text-align:center; text-decoration: underline}
.specs2 {font-size:16pt; color: blue; text-align:center}
.head {font-size:28pt; color:purple; text-align:center;
text-decoration:underline; font-weight: bold}
.ex {font-size: 18; color:black; text-align: right}
a:link {color:blue; background-color:transparent; text-decoration:none}
a:visited {color:purple; background-color:transparent; text-decoration:none}
a:hover {color:red; background-color:transparent; text-decoration:underline}
a:active {color:yellow; background-color:transparent; text-decoration:underline}
<P class = "head"> TEXT
</P>
<P Class = "need1"> TEXT
<BR>TEXT <span Class = "red1">TEXT</span> TEXT
<BR>TEXT
<BR>
<BR>TEXT
<P Class = "cata">
TEXT
</P>
<P>
<BR>TEXT = <span class= "red1">RED</span>
<BR>TEXT = ORANGE
<BR>TEXT =
<P Class = "head">
TEXT[Jfiddle Screencapture][1]
</P>