css - 响应式 CSS 的无序列表不以 DIV 为中心?

标签 css html html-lists responsive-design

在进行响应式设计时,我注意到除了无序列表之外的所有内容都是响应式的。当我调整浏览器大小时,列表不会移动或保持在其 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;
}

}

最佳答案

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

我添加了 text-align:center; 并且成功了。

#sitecontent .leftsidebar {
  width: 100%;
  float: none;
  text-align: center;
}

关于css - 响应式 CSS 的无序列表不以 DIV 为中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13465384/

相关文章:

java html解析器多页表

html - 如何使用 css 使我的菜单宽度为浏览器的 100%

css - 无法在响应式布局上调整背景大小

javascript - 使用 Javascript 导航,但更改 URL

html - 为什么 `position:relative` 在 safari 和 opera 的开发工具中被计算为 `position: static`?

jquery - 使用 jQuery 激活选项卡

jquery - 我在一个表中并排运行 2 个 jquery 循环幻灯片,似乎无法让它们居中对齐

javascript - .InnerHTML 在 Internet Explorer 中无法正常工作

css - 如何在中间打破无序列表?