我想让我的博客具有响应性,但我的媒体查询效果不佳。css 代码在最大宽度 600px 中工作,但它不适用于较小的宽度。这是css代码(最大宽度:600px);
@media only screen and (max-width: 600px) {
.container{
height:100%;
}
#header{
max-height:162px;
}
#header #logo{
padding-bottom: 63px;
}
.nav {
max-width:599px;
position: relative;
float:center;
padding-bottom:120px;
top:159px;
left:-60px;
min-height: 40px;
padding-top:0;
}
.nav ul {
/*width: 599px;*/
padding: 5px 0;
position: absolute;
/*top: -13px;
left: -95px;*/
border: solid 1px #2FB8C8;
background: #2FB8C8 url(../images/icon-menu.png) no-repeat 10px 11px;
}
.nav li {
display: none; /* hide all <li> items */
margin: 0;
opacity:0.8;
}
.nav .current {
display: block; /* show only current <li> item */
}
.nav a {
display: block;
padding: 5px 5px 5px 32px;
text-align: left;
width:599px;
}
.nav .current a {
background: none;
color: #666;
}
/* on nav hover */
.nav ul:hover {
opacity:1;
}
.nav ul:hover li {
display: block;
margin: 0 0 5px;
}
.nav ul:hover .current {
background: url(../images/icon-check.png) no-repeat 10px 7px;
}
/* right nav */
.nav.right ul {
left: auto;
right: 0;
}
/* center nav */
.nav.center ul {
left: 50%;
margin-left: -90px;
}
.end-post-right{
font-family:'RobotoLight' ;
display:block;
width:400px;
/*padding-left:10px;*/
font-weight:normal;
letter-spacing: 0.8px;
}
.end-post-right li{
display:block;
margin-right: 15px;
float:left;
}
.end-post-right li p{
font-size:100%;
}
.end-post-right span{
font-size:100%;
}
}
这是另一个不起作用的媒体查询的示例。我在 iphone 5 上试了试;
/* Iphone <5 */
@media screen and (device-aspect-ratio: 2/3) {
.end-post-right{
font-family:'RobotoLight' ;
display:block;
/*width:400px;
padding-left:10px;*/
font-weight:normal;
letter-spacing: 0.8px;
}
.end-post-right li{
display:block;
/*margin-right: 15px;*/
float:left;
}
.end-post-right li p{
font-size:100%;
}
.end-post-right span{
font-size:100%;
}
}
在此先感谢您的帮助