1

在进行响应式设计时,我注意到除了我的无序列表之外的所有内容都是响应式的。当我调整浏览器的大小时,列表不会移动或保持在其 DIV 的中心。我一整天都尝试了很多东西,但就是想不通。对于上下文,#sitecontent 是包含所有内容的容器,#sitecontent .leftsidebar 包含图像和无序列表,#sitecontent .leftsidebar ul 是无序列表。有人可以检查一下并告诉我出了什么问题吗?

@-moz-document url-prefix() {
* { font-weight: 400; }
h1, h2 
}

@font-face { font-family: 'helvetica neue'; src: local('Arial'); } 

x:-o-prefocus, h1 {
padding-top: 22px;
}

x:-o-prefocus, h2 {
margin-top: -2%;
}

x:-o-prefocus, ul li {
line-height: 20px;
}


#sitecontent {
display: block;
width: 90%; /* 780px */
max-width: 780px;
padding-top: 150px;
margin: 0 auto;
}

#sitecontent .leftsidebar {
float: left;
width: 19.2%; /* 150px */
}

#profilepic {
-moz-border-radius: 20px;
border-radius: 20px;
max-width: 100%;
}
#sitecontent .leftsidebar ul {
position: relative;
top:-5px;
list-style-type: none;
font-family: 'Patua One', cursive;

}

#sitecontent a {
text-decoration: none;
color: #3f83ca;
}

#sitecontent .leftsidebar ul li{
display:inline;
margin-bottom: 3%;
float: left;
clear: both;
border-bottom: 1px solid #E5E5E5;
font-family: helvetica;
}

#sitecontent .leftsidebar ul li:hover {
border-bottom: 1px solid #3f83ca;
}



#sitecontent .rightsidebar {
float: right;
width: 76.9%;

}

#sitecontent .rightsidebar > h1 {
font-size:3.750em;
font-weight: normal;
color: #3f83ca;
line-height: 0;
font-family: helvetica;
font-weight:bold;

}

#sitecontent .rightsidebar > h2 {
line-height: 10px;
font-weight: normal;
color: #38414f;
font-family: helvetica;
font-weight: bold;

}

#sitecontent .rightsidebar > p {
text-align: justify;
padding-top: 16px;
line-height: 20px;
font-size: 0.938em;
font-family:'Helvetica Neue', Arial, sans-serif;


}

#secondparagraph {
text-align: justify;
color: #A1A1A1;
font-family:'Helvetica Neue', Arial, sans-serif;


}

#secondparagraph:hover {
color:#3f83ca;
opacity: 1.0;

}

#secondparagraph a {
font-size: 14px;
text-decoration: none;
color: inherit;
}

@media screen and (max-width: 480px) {


#sitecontent {
width: 100%;
padding-top: 10px;
}

#sitecontent .leftsidebar {
width: 100%;
float: none;
}

#profilepic {
display:block;
margin: 0 auto;
border-radius: 77px;
float:none;
}

#sitecontent .leftsidebar ul {  
position: relative;
top:35px;
}



#sitecontent .leftsidebar ul li{
margin-bottom: none;
border-bottom: none;
float: none;
clear: none;
padding:10px;
border-radius: 2px;
background-color:#3f83ca;
border: 1px solid #00688B;
font-family: helvetica;
font-weight: 400;
}

#sitecontent a {
text-decoration: none;
color: #EDEDED;
}

#sitecontent .leftsidebar ul li:hover {
border-bottom: none;
}

#sitecontent .rightsidebar {
float: none;
margin: 0 auto;
width: 90%;

}

#sitecontent .rightsidebar > h1 {
position: relative;
bottom: 36px;
text-align: center;
font-size:1.875em;
font-weight: 600;
color: #3f83ca;
margin-top: 6%;
font-family: helvetica;
font-weight:bold;

}

#sitecontent .rightsidebar > h2 {
display:none;

}

#secondparagraph {
display: none;

}

#sitecontent .rightsidebar > p > a:first-child {
color:#3f83ca;
}

}
4

1 回答 1

0

我只在站点最小化和最小化时才看到居中问题。

我补充说text-align:center;,它奏效了。

#sitecontent .leftsidebar {
  width: 100%;
  float: none;
  text-align: center;
}
于 2012-11-20T02:27:54.613 回答