css样式类没有改变

时间:2015-12-05 08:37:21

标签: html css

好的,我真的很新。几个小时前,我将样式类“P”设置为

...// <Style>
          P {color:black, font-size: 16pt;}
...// </Style>

我认为它可能已经破坏了一些东西!我的所有其他代码行都在工作但是这一行!我认为它会让每个默认的新段落都是黑色16pt ......但它不会让我改变颜色。

.need1类没有被正确调用,并显示为黑色16pt的先前设置,而不是.need1类的居中,24pt红色,粗体文本。

此外,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>

enter image description here

3 个答案:

答案 0 :(得分:0)

在颜色后面加一个分号,你可以用逗号代替。

P {color:black,font-size:16pt;}更改为P {color:black; font-size:16pt;}

希望有所帮助!

答案 1 :(得分:0)

第二个和第四个p标签没有匹配的结束标记与BR标签更改相同,它将起作用也删除&#34;。&#34;样式打开和关闭标记后

答案 2 :(得分:0)

尝试使用!important

 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}

但首先你必须纠正代码中的错误,例如:为什么要写#34;。&#34;在风格之后,你必须写&#34;;&#34;在css之间没有属性&#34;。&#34; 修复后的代码

&#13;
&#13;
<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>
&#13;
max-height: 25vh;
&#13;
&#13;
&#13;