作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在两列中显示元素列表。但是两个列项之间的空间较小。我想要更多的空间。我应该在哪里改变?我试图添加更多像素作为填充。但它没有用。
#category{
background: #062134;
color: white;
display: table;
width:100%;
font-size: 20px;
-webkit-box-align: center;
-webkit-box-pack: center;
-moz-box-align: center;
-moz-box-pack: center;
display: -webkit-box;
display: -moz-box;
}
#category .column-title {
margin-bottom: 30px;
font-weight: bold;
}
#category > div {
display: table-row;
}
#category > div > div {
display: table-cell;
padding-top: 50px;
padding-bottom: 50px;
padding-right: 50px;
padding-left: 50px;
}
#category > div > div:first-child {
padding-left: 5%;
padding-right: 1%;
}
#category .column-title {
margin-bottom: 30px;
font-weight: bold;
}
#category > div {
display: table-row;
}
#category > div > div {
display: table-cell;
padding-top: 50px;
padding-bottom: 50px;
}
#category > div > div:first-child {
padding-left: 5%;
padding-right: 1%;
}
#category > div > div:nth-child(2) {
padding-left: 1%;
padding-right: 1%;
}
#category > div > div:nth-child(3) {
padding-left: 1%;
padding-right: 30%;
}
#category p {
line-height: 300%;
}
#category input {
display: block;
float: left;
background: #062134;
/*border: 2px solid white;*/
border-top: 2px solid white;
border-right: 0;
border-bottom: 2px solid white;
border-left: 2px solid white;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
/*padding: 10px;*/
color: white;
height: 36px;
text-indent: 10px;
}
#category button {
float: left;
background: #062134 10px 10px no-repeat;
height: 40px;
width: 70px;
height: 40px;
border-top: 2px solid white;
border-right: 2px solid white;
border-bottom: 2px solid white;
border-left: 0;
border-left: 0;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
margin-bottom: 30px;
}
/*.row-2 p {
clear: left;
}*/
#category input:focus {
outline: 0;
background: #4D7EC9;
}
#category input:hover {
box-shadow: 0 0 0.5em white;
}
#category button:hover {
background-color: blue;
}
#category button:focus {
outline: 0;
}
.list-of-resources {
display: table;
}
.list-of-resources > div {
display: table-row;
}
.list-of-resources > div > div {
display: table-cell;
padding: 5px 0;
}
.list-of-resources > div > div:last-child {
padding: 0 0 0 100px;
}
.list-of-resources a {
text-decoration: none;
color: white;
}
.list-of-resources a:hover {
color: tomato;
}
@media screen and (max-width: 900px) {
#category > div > div {
display: table-cell;
width: 28%;
padding-top: 50px;
}
#category > div > div:first-child {
padding-left: 5%;
padding-right: 1%;
}
#category > div > div:nth-child(2) {
padding-left: 1%;
padding-right: 1%;
}
#category > div > div:nth-child(3) {
padding-left: 1%;
padding-right: 5%;
}
}
@media screen and (max-width: 600px) {
#category > div > div {
width: 90%;
-webkit-flex: 1 6 20%;
flex: 1 6 20%;
-webkit-order: 3;
order: 3;
}
#category > div > div:nth-child(2) {
clear: both;
padding-left: 5%;
padding-top: 10px;
}
}
<div id="category">
<div>
<div class="column">
<div class="column-title">Explore</div>
<div class="column-content list-of-resources">
<div>
<div><a href="#">Envato</a></div>
<div><a href="#">Themeforest</a></div>
</div>
<div>
<div><a href="#">Themecurve</a></div>
<div><a href="#">Microsoft</a></div>
</div>
<div>
<div><a href="#">Kreativeshowcase</a></div>
<div><a href="#">Google</a></div>
</div>
<div>
<div><a href="#">Freebiescurve</a></div>
<div><a href="#">Yahoo</a></div>
</div>
</div>
</div>
</div>
</div>
最佳答案
Your code is working...But When I put into mobile view,I wanted that the lists will go down..but in mobile view the lists are in same place.
你可以使用这个代码
CSS
#category{
background: #062134;
color: white;
display: table;
width:100%;
font-size: 20px;
-webkit-box-align: center;
-webkit-box-pack: center;
-moz-box-align: center;
-moz-box-pack: center;
display: -webkit-box;
display: -moz-box;
}
#category .column-title {
margin-bottom: 30px;
font-weight: bold;
}
#category > div {
display: table-row;
}
#category > div > div {
display: table-cell;
padding-top: 50px;
padding-bottom: 50px;
padding-right: 50px;
padding-left: 50px;
}
#category > div > div:first-child {
padding-left: 5%;
padding-right: 1%;
}
#category .column-title {
margin-bottom: 30px;
font-weight: bold;
}
#category > div {
display: table-row;
}
#category > div > div {
display: table-cell;
padding-top: 50px;
padding-bottom: 50px;
}
#category > div > div:first-child {
padding-left: 5%;
padding-right: 1%;
}
#category > div > div:nth-child(2) {
padding-left: 1%;
padding-right: 1%;
}
#category > div > div:nth-child(3) {
padding-left: 1%;
padding-right: 30%;
}
#category p {
line-height: 300%;
}
#category input {
display: block;
float: left;
background: #062134;
/*border: 2px solid white;*/
border-top: 2px solid white;
border-right: 0;
border-bottom: 2px solid white;
border-left: 2px solid white;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
/*padding: 10px;*/
color: white;
height: 36px;
text-indent: 10px;
}
#category button {
float: left;
background: #062134 10px 10px no-repeat;
height: 40px;
width: 70px;
height: 40px;
border-top: 2px solid white;
border-right: 2px solid white;
border-bottom: 2px solid white;
border-left: 0;
border-left: 0;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
margin-bottom: 30px;
}
/*.row-2 p {
clear: left;
}*/
#category input:focus {
outline: 0;
background: #4D7EC9;
}
#category input:hover {
box-shadow: 0 0 0.5em white;
}
#category button:hover {
background-color: blue;
}
#category button:focus {
outline: 0;
}
.list-of-resources {
width: 800px;
}
.list-of-resources #left
{
float: left;
width: 400px;
}
.list-of-resources #right
{
float: right;
width: 400px;
}
.list-of-resources a {
text-decoration: none;
color: white;
}
.list-of-resources a:hover {
color: tomato;
}
@media screen and (max-width: 900px) {
.list-of-resources {
width: 100%;
}
.list-of-resources #left
{
float: left;
width: 100%;
}
.list-of-resources #right
{
float: left;
width: 100%;
}
}
@media screen and (max-width: 600px) {
#category > div > div {
width: 90%;
-webkit-flex: 1 6 20%;
flex: 1 6 20%;
-webkit-order: 3;
order: 3;
}
#category > div > div:nth-child(2) {
clear: both;
padding-left: 5%;
padding-top: 10px;
}
}
html
<div id="category">
<div>
<div class="column">
<div class="column-title">Explore</div>
<div class="column-content list-of-resources">
<div id="left">
<div><a href="#">Envato</a></div>
<div><a href="#">Themecurve</a></div>
<div><a href="#">Kreativeshowcase</a></div>
<div><a href="#">Freebiescurve</a></div>
</div>
<div id="right">
<div><a href="#">Themeforest</a></div>
<div><a href="#">Microsoft</a></div>
<div><a href="#">Google</a></div>
<div><a href="#">Yahoo</a></div>
</div>
</div>
</div>
</div>
图片
关于html - 如何在两个列项之间留出空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31592931/
这是我的jade雕像: section#entry-review-template.template(data-class='entry-review') table thead
我是一名优秀的程序员,十分优秀!