首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CSS不应用,样式显示为空白?

CSS不应用,样式显示为空白?
EN

Stack Overflow用户
提问于 2014-02-09 13:38:54
回答 4查看 401关注 0票数 1

我已经通过CSS文件向我的页面添加了一些CSS。然而,当我加载页面时,CSS并没有被应用。

当我查看firebug时,CSS样式显示为空,即

代码语言:javascript
复制
.logomain img {
}
.logocorn {
}

但是,当我单击源代码编辑时,它们会显示?i.e

代码语言:javascript
复制
.logomain img {
    width: 40% !important;
    padding-left: 40px !important;
}

.logocorn {
    float: right !important;
}

知道发生了什么事吗?

编辑: CSS文件如下所示:

代码语言:javascript
复制
body {
    color: #7E7171;
    font-family: 'Open Sans',sans-serif;
    font-weight: 300;
}
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}
h1 {
    color: #3B3B3B;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 50px;
    margin-bottom: 0;
}
h2 {
    color: #3B3B3B;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 50px;
}
h3 {
    color: #3B3B3B;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 20px;
    font-weight: 700;
}
h4 {
    color: #7E7171;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 14px;
}
h5 {
    color: #3B3B3B;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 13px;
}
p {
    color: #7E7171;
    font-size: 16px;
    line-height: 25px;
    margin-top: 10px;
}
a {
    text-decoration: none;
    transition: all 0.2s ease-out 0s;
}
code {
    background-color: #F7F4F2;
    color: #7E7171;
    font-size: 14px;
    line-height: 22px;
}
pre {
    background-color: #F7F4F2;
    border: medium none;
    border-radius: 0;
    color: #7E7171;
    font-size: 14px;
    line-height: 22px;
}
blockquote {
    border-left: 5px solid #F7F4F2;
}
blockquote p {
    font-size: 24px;
    line-height: 45px;
    margin-top: 0;
}
input {
    padding: 6px;
}
.arrow-down {
    border-left: 5px solid rgba(0, 0, 0, 0);
    border-right: 5px solid rgba(0, 0, 0, 0);
    border-top: 5px solid #404040;
    height: 0;
    position: absolute;
    right: 48px;
    top: 0;
    width: 0;
}
.social-header.active .arrow-down {
    top: 50px;
}
a:hover {
    color: #333333;
    cursor: pointer;
    text-decoration: none;
}
header ul li {
    display: inline;
}
header {
}
.top-header {
    background-color: #F16252;
    padding-bottom: 14px;
}
.home-template .bottom-header {
    background-color: #404040;
    padding-bottom: 50px;
    padding-top: 50px;
    text-align: center;
}
.home-template h5 {
    color: #FFFFFF;
    font-family: 'Roboto',sans-serif;
    font-size: 40px;
    font-weight: 100;
    line-height: 62px;
    text-align: center;
}
.home-template .bottom-header a {
    display: none;
}
.archive-template .bottom-header {
    background-color: #404040;
    padding-bottom: 50px;
    padding-top: 50px;
    text-align: center;
}
.archive-template h5 {
    color: #FFFFFF;
    font-family: 'Roboto',sans-serif;
    font-size: 40px;
    font-weight: 100;
    line-height: 62px;
    text-align: center;
}
.archive-template .bottom-header a {
    display: none;
}
h1.logo {
    margin-top: 9px;
}
h1.logo a {
    color: #FFFFFF;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 50px;
}
h1.post_title a {
    font-size: 22px;
    line-height: 25px;
}
.excerpt {
    font-size: 13px;
}
h1.post_title {
    line-height: 19px;
    margin-bottom: 10px;
    margin-top: 10px;
}
.social-header {
    background-color: #404040;
    color: #FFFFFF;
    height: 50px;
    line-height: 50px;
    margin-top: -50px;
    text-align: right;
    transition: all 0.2s ease-out 0s;
}
.social-header .container {
    position: relative;
}
.social-header.active {
    margin-top: 0;
}
.social-header a {
    color: #FFFFFF;
}
.social-header a:hover {
    color: #3DD765;
}
.social {
    height: 40px;
    margin-top: 25px;
    text-align: right;
}
.social-header ul li {
    padding-left: 20px;
}
.social ul li {
    padding-left: 20px;
}
.social a {
    color: #FFFFFF;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: bold;
    line-height: 30px;
    text-transform: uppercase;
}
.social a:hover {
    color: #333333;
}
.social-icons {
}
.social-icons a {
    padding-left: 20px;
}
.close-social {
    border-left: 3px solid;
    margin-left: 15px;
    padding-left: 15px;
}
.main {
}
.post h1 a {
    color: #333333;
}
.post h1 a:hover {
    color: #333333;
}
.post-template .author-mobile {
    display: none;
}
.author {
    margin-top: 20px;
}
.author ul li {
    text-align: center;
}
.author-image span img {
    border-radius: 100%;
    height: 100px;
    overflow: hidden;
    width: 100px;
}
.author-image span .info {
    border-radius: 100%;
    height: 100px;
    width: 100px;
}
.author-name {
    color: #F16252;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-top: 10px;
    text-transform: uppercase;
}
.post-date {
    color: #7E7171;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 14px;
    margin-top: 5px;
}
.author-mobile {
    color: #7E7171;
    float: left;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 12px;
    font-weight: 300;
    line-height: 14px;
    margin-top: 5px;
}
.author-mobile img {
    border-radius: 100%;
    height: 30px;
    width: 30px;
}
.author-mobile span {
    color: #F16252;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 14px;
}
.author-mobile time {
    color: #7E7171;
    display: block;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 14px;
}
.post-template .author-mobile time {
    display: inline;
}
.author-name {
    color: #F16252;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-top: 10px;
    text-transform: uppercase;
}
.post-date {
    color: #7E7171;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 14px;
    margin-top: 5px;
}
span.tags {
    color: #7E7171;
    display: block;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 12px;
    font-weight: 700;
    height: 27px;
}
span.tags i {
    margin-right: 5px;
}
.post-container a.more {
    background-color: #F16252;
    color: #FFFFFF;
    float: right;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: bold;
    line-height: 19px;
    padding: 10px;
    text-transform: uppercase;
}
.post-container a.more:hover {
    background-color: #3DD765 !important;
    color: #FFFFFF !important;
}
.post-container div.content {
    display: none;
}
p.content {
    margin-top: 50px;
}
.post-container {
    background-color: #FFFFFF;
    margin-top: 70px;
    transition: all 0.2s ease-out 0s;
}
.post-container:hover {
    background-color: #F5F5F5;
}
.post-container:hover .post-bottom {
    border-top: 1px solid #CCCCCC;
}
.post-container:hover article {
    border: medium none;
}
article {
    padding-top: 15px;
}
.post-bottom {
    border-top: 1px solid #EEEEEE;
    bottom: 0;
    padding-bottom: 15px;
    padding-top: 15px;
    position: absolute;
    width: 100%;
}
.post-container article {
    border-bottom: 2px solid #EEEEEE;
    height: 390px;
    position: relative;
}
h1.post_title a:hover {
    color: #F16252;
}
.postimg-slider {
    background-color: #FFFFFF;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    height: 150px;
    position: relative;
}
.loading {
    background-image: url("../images/loading.gif");
}
.postimg-slider ul li {
}
.postimg-slider .prev {
    background-color: #FFFFFF;
    border-radius: 3px;
    display: block;
    font-size: 10px;
    height: 20px;
    padding-left: 5px;
    padding-top: 2px;
    right: 40px;
    width: 20px;
}
.postimg-slider .next {
    background-color: #FFFFFF;
    border-radius: 3px;
    display: block;
    font-size: 10px;
    height: 20px;
    padding-left: 5px;
    padding-top: 2px;
    right: 15px;
    width: 20px;
}
.postimg-slider ul {
    list-style-image: none !important;
    list-style-type: none;
    margin: 0;
    padding: 0;
}
.postimg-slider ul {
    width: 100%;
}
.postimg-slider ul li {
    height: 150px;
    margin: 0;
    padding: 0;
    width: 100%;
}
.post .postimg-slider ul li img {
    width: 100%;
}
.rslides {
    position: absolute;
}
.rslides_nav {
    position: absolute;
    top: 15px;
    z-index: 9999;
}
.post {
    padding-bottom: 30px;
}
.post a {
    color: #F16252;
}
.post a:hover {
    color: #3DD765;
}
.paginate {
    margin-bottom: 50px;
    margin-top: 50px;
}
.paginate .older {
    margin-top: 13px;
    text-align: left;
}
.paginate .older a i {
    padding-right: 10px;
}
.paginate .page-nr {
    color: #7E7171;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 40px;
    font-weight: 300;
    text-align: center;
    text-transform: uppercase;
}
.paginate .newer {
    margin-top: 13px;
    text-align: right;
}
.paginate .newer a i {
    padding-left: 10px;
}
.paginate a {
    color: #333333;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: bold;
    line-height: 30px;
    text-transform: uppercase;
}
.paginate a:hover {
    color: #F16252;
}
.paginate a i {
    font-size: 13px;
    line-height: 3px;
}
footer {
    background-color: #404040;
    font-family: "Open Sans";
    font-weight: 400;
    height: 80px;
}
footer p {
    color: #FFFFFF;
    font-size: 12px;
    line-height: 15px;
    margin-top: 18px;
    text-align: center;
}
footer a {
    color: #3DD765;
}
footer a:hover {
    color: #FFFFFF;
}
.post-template .bottom-header {
    background-color: #404040;
    height: 66px;
    padding-top: 0;
    text-align: left;
}
.post-template .bottom-header a {
    color: #FFFFFF;
    font-family: 'Roboto Condensed',sans-serif;
    font-size: 14px;
    font-weight: bold;
    line-height: 66px;
    text-transform: uppercase;
}
.post-template .bottom-header a i {
    margin-right: 10px;
}
.post-template .back:hover {
    color: #F16252;
}
.post-template h5 {
    display: none;
}
.post ul {
    list-style-image: url("img/red.png");
}
.post li {
    color: #7E7171;
    font-family: "Open Sans";
    font-size: 13px;
    line-height: 30px;
    margin-left: 17px;
}
.full img {
    max-width: 100%;
}
.share {
    border-bottom: 1px solid #E0E0E0;
    margin-bottom: 50px;
    margin-top: -50px;
}
.share a {
    color: #FFFFFF;
    text-align: center;
}
.share a:hover {
    color: #333333;
}
.share h3 {
    color: #7E7171;
    font-size: 14px;
    line-height: 62px;
    text-align: center;
    text-transform: uppercase;
}
.share_social {
    height: 40px;
    margin-bottom: 40px;
}
.share span {
}
.share span a {
    background: none repeat scroll 0 0 #F16252;
    border-radius: 3px;
    display: inline-block;
    height: 40px;
    line-height: 39px;
    margin-left: 6px;
    margin-right: 6px;
    text-align: center;
    width: 40px;
}
.share span a:hover {
    background-color: #3DD765;
    color: #FFFFFF;
}
@media (max-width: 410px) {
}
@media (max-width: 455px) {
.social {
    margin-left: -30px;
}
}
@media (max-width: 767px) {
.newer span, .older span {
    display: none;
}
.newer a i, .older a i {
    font-size: 22px;
}
.newer a, .older a {
    font-size: 22px;
}
}
@media (min-width: 768px) {
}
@media (max-width: 992px) {
.post-template .author-mobile {
    display: block;
}
.post-template span.tags {
    clear: both;
    padding-top: 10px;
}
.author {
    display: none;
}
}
@media (min-width: 1200px) {
}
#add_this {
    margin: 0 auto;
    width: 242px;
}
.col-md-9 img:nth-of-type(1) {
    width: 0;
}
.logomain img {
    padding-left: 40px !important;
    width: 40% !important;
}
.logocorn {
    float: right !important;
}
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2014-02-13 21:52:30

我想知道您在哪里设置了类,它是扩展屏幕或容器的宽度的<div>还是<span><a>之类的东西。如果没有,在<div>上试一试。

另外,如果您正在使用引导程序,例如,您可以尝试类.拉左.拉右,因为它们已经具有与它们相关的良好规则。

票数 0
EN

Stack Overflow用户

发布于 2014-02-11 20:05:23

CSS文件的格式似乎是正确的,请参阅此jsFiddle

其他CSS样式是否应用于您的页面?

代码语言:javascript
复制
body {
    color: #7E7171;
    font-family: 'Open Sans',sans-serif;
    font-weight: 300;
}

?如果没有正确加载整个CSS文件,那么这个解决方案需要更多关于您的环境=的信息。)

控制台中有错误消息吗?

票数 0
EN

Stack Overflow用户

发布于 2014-02-11 20:14:27

您的结束支撑为您的@media (min-width:1200px)没有正确关闭。

代码语言:javascript
复制
    @media (min-width: 1200px) {

    #add_this {
        margin: 0 auto;
        width: 242px;
    }
    .col-md-9 img:nth-of-type(1) {
        width: 0;
    }
    .logomain img {
        padding-left: 40px !important;
        width: 40% !important;
    }
    .logocorn {
        float: right !important;
    }

}

您在任何样式之前关闭了@media。在你的帖子里你有@media (min-width:1200px) { }

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21659708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档