我已经通过CSS文件向我的页面添加了一些CSS。 但是,当我加载页面时,CSS没有被应用。
当我查看firebug时,CSS样式显示为空,即
.logomain img {
}
.logocorn {
}
然而,当我点击源编辑时,他们会显示?即
.logomain img {
width: 40% !important;
padding-left: 40px !important;
}
.logocorn {
float: right !important;
}
任何想法发生了什么?
编辑:CSS文件如下所示:
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;
}
答案 0 :(得分:0)
CSS文件似乎格式正确,请参阅此jsFiddle。
其他CSS样式是否会应用于您的网页,例如
body {
color: #7E7171;
font-family: 'Open Sans',sans-serif;
font-weight: 300;
}
?如果没有,似乎整个CSS文件没有被正确加载 - 并且该解决方案需要更多关于您的环境的信息=)
控制台中的任何错误消息?
答案 1 :(得分:0)
@media (min-width:1200px)
的结束括号未正确关闭。
@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) { }
答案 2 :(得分:0)
答案 3 :(得分:0)
我想知道你的课程设置在哪里,是<div>
会扩大屏幕或容器的宽度,还是像<span>
或<a>
那样。如果没有,请在<div>
上试用。
另外,如果你使用bootstrap,你可以尝试使用 .pull-left 和 .pull-right 这两个类,因为它们已经有了很好的相关规则。