0

我有一个网站,我试图做出响应,当我申请时@media only screen and (min-width: 180px) and (max-width: 267px),内容区域在右侧被切断。下面是我应用到页面的 CSS。请问我做错了什么?

谢谢你。

CSS

.content_body{
margin: 0 auto;
width: 100%;
overflow: hidden;
padding-top: 30px;
 background:    #C9C7BB;
color:    #555;
font-family:  Tahoma, Arial, sans-serif;
font-size:    14px;
min-height: 200px;  
}

.bio_wrapper{
line-height: 25px;
 padding: 20px 0px 500px 50px;
}

 .bio_left{
 width: 800px;
 float: left;
 font-family: lato;
 color: black; 
}

.bio_images{
margin: 0;
margin-top: 30px;
margin-bottom: 90px;
}

.bio_images li{
padding-right: 35px;
display: inline;
list-style-type: none;
}

.bio_images li:last{
   padding-right: none; 
 }

 .bio_images img{
border: 4px solid #999966;
border-radius: 5px; 
}

.bio_mainimage{
float:right;
width: 20%; 
}

  @media only screen and (min-width: 180px) and (max-width: 267px) {

 .bio_mainimage{
  display: none;
  }

.content_body{
margin: 0 auto;
width: 50%;
overflow: hidden;
padding-top: 30px;
 background:    #C9C7BB;
color:    #555;
font-family:  Tahoma, Arial, sans-serif;
font-size:    14px;
min-height: 200px;  
 }

.bio_images img{
display: block;
}
}

示例页面

4

1 回答 1

0

.bio_left绝对宽度为 800px。因为.content_body已将溢出设置为隐藏且其宽度为 100%,所以内容会被剪掉。

出现在页面底部的 bios.png 图像更适合作为背景图像。它没有呈现任何内容,只是在狭窄的设备上看起来很奇怪(不,display: none让它从狭窄的设备中隐藏起来并不是“删除”它的好方法)。

这种布局确实会受益于首先为窄设备设计样式,然后将所有浮动、绝对宽度和奇数边距隐藏在检查更宽设备的媒体查询中。

此外,媒体查询不需要最小宽度和最大宽度。您可以指定最大宽度。我不认为有任何设备宽度小于 180 像素。

于 2013-01-13T13:10:49.290 回答