html - 单个 CSS 类拒绝表现

标签 html css firefox

我有一个 CSS3 类拒绝将其属性应用于文本。我改了好多次名字,还是有问题。在运行 Ubuntu 的 Chrome 和 Firefox 中测试,尚未安装 IE。 CSS 和 HTML 均已通过 w3 验证

CSS3:

body {
    background-color: #000000;
    color:white;
    margin-left: 10px;
    line-height: 200%;
}
h1, h2 {
    text-align: center;
    color:#FFFFFF;
}
.one {
    color: white;
    background-color: black;
    margin: 50px;
    font-weight: bolder;
    font-stretch: wider;
    font-variant: small-caps;
    font-style: italic;
    font-size: xx-large;
    font-family: Ubuntu, sans-serif;
}
.two {
    color: white;
    background-color: black;
    /*  margin: 10px;
      width: 500px;
      height: 70px;*/
    display: inline-block;
    font-family: Consolas, monaco, monospace;
}
a:link {
    color:#FF00FF;
}
/* unvisited link */
 a:link {
    background-color: black;
}
a:visited {
    color:#66FF33;
}
/* visited link */
 a:hover {
    color:#FF0099;
}
/* mouse over link */
 a:active {
    color:#66FF33;
}
/* selected link */
 a:focus {
    color:#FF9900
}
.ptxt {
    color: green;
    background-color: black;
    margin: 50px;
    display: inline-block;
    font-style: italic;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
.list {
    color: white;
    background-color: black;
    margin: 50px;
    /*  width: 500px;
      height: 70px;*/
    display: inline-block;
    font-style: italic;
    font-family:"Comic Sans MS", cursive, sans-serif
}
.header {
    color: white;
    background-color: black;
    margin: 50px;
    /*  width: 500px;
      height: 70px;*/
    display: inline-block;
    font-size: large;
    font-style: normal;
    font-weight: bolder;
    font-family: font-family: Perpetua, Baskerville, "Big Caslon", "Palatino Linotype", Palatino, "URW Palladio L", "Nimbus Roman No9 L", serif;
}

HTML5:

<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8" />
        <title>This is a shell for an HTML5 webpage.</title>
        <link rel="stylesheet" type="text/css" href="Moog%20Page.css">
    </head>

    <body>
        <div>
            <div class="one">Site Index and Utilized Resources</div>
            <div class="two">
                <div class="list">
                    <p> <a href="http://www.cssbuttongenerator.com/">Here</a> is a website I used to make a CSS Button. I found it pretty handy.</p>
                    <p> <a href="http://www.moogmusic.com/">Moog Music</a> gave me a lot of inspiration for this website, and I definitely owe them some of the credit. Plus, by adding yet another link, I increase your odds of visiting the site and drooling over synthesizers.</p>
                    <p> <a href="http://www.w3schools.com/">The w3schools</a> site certainly deserves a round of applause- I frantically prowled around site looking for documentation while trying to complete this assignment.</p>
                    <p>And, of course, <a href="http://www.ncssm.edu/~morrison/">Dr. Morrison</a>, who gave me the tools (and the assignment) for making this site. If not for him (and his requirement that I build this to get a grade), this site would not exist at all.</p>
                </div>
                <div class="ptxt">
                    <p>This text simply refuses to behave according to the standards of the "ptxt" class.
                        <!-- To Black Hats: The server running this is a Raspberry Pi. It would be really lame if you tried to take my server down, because anyone can take down a server with less than A Gig of RAM. You should go for the big fish, like Brainhoney or something. (Seriously though, don't do that; I've dealt with idiocy like that already.) -->
                    </p>
                </div>
            </div>
    </body>

</html>

文本不响应“ptxt”类,但在更改为其他类(例如“one”或“list”)时响应。

感谢您提供的任何帮助。

最佳答案

你有 <style> CSS 表中的标签。删除它们,它应该可以工作。

<style type="text/css">
a:link {color:#FF00FF;}    /* unvisited link */
a:link {background-color: black;}
a:visited {color:#66FF33;} /* visited link */
a:hover {color:#FF0099;}   /* mouse over link */
a:active {color:#66FF33;}  /* selected link */
a:focus {color:#FF9900 }
</style>

收件人:

a:link {color:#FF00FF;}    /* unvisited link */
a:link {background-color: black;}
a:visited {color:#66FF33;} /* visited link */
a:hover {color:#FF0099;}   /* mouse over link */
a:active {color:#66FF33;}  /* selected link */
a:focus {color:#FF9900 }

关于html - 单个 CSS 类拒绝表现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22103922/

相关文章:

javascript - 2 种类型的文本区域值

jquery - 滚动 spy 错误 : Wrong nav item activated

css - 网格项不尊重网格模板区域中的点表示法

javascript - 我如何在 React 重新渲染之前转换动画?

javascript - document.activeElement 在仅适用于 Gmail 的 firefox 插件的内容脚本中不可用

javascript - firefox 和 javascript 重定向

javascript - 如何使用带有事件处理程序的按钮在html中显示函数计算

javascript - 按品牌一一展示产品系列

css - 如何创建页内水平导航锚定系统?

html - FF 渲染位置相对于所有其他浏览器不同