我有一行可以包含3-5個div。 div需要水平(左/右)居中。點擊divs'flip'顯示更多信息。除了翻轉時,居中工作正常,然後看起來divs高度發生變化,他們不再垂直對齊。如果我補充一下:在這個問題就沒有了CSS線24「浮動左」,但隨後他們不再水平中心組div連續
https://jsfiddle.net/rffxmbh0/1/
#readModal>.modal-lg {
width: 100%;
margin: auto;
}
#readModalContent {
height: 420px;
}
.row-center {
text-align:center;
}
#readModal h2{
padding-left: 25px;
}
.col-centered {
padding:0;
}
.whatToReadCover {
display:inline-block;
float:none;
height: 350px;
width: 255px;
background-color: white;
border: 1px solid;
border-radius: 6px;
margin: 0 0 0 12px;
text-align: center;
}
.whatToReadCover p,
.whatToReadCover .description {
width: 170px;
text-align: left;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
margin:0;
}
.cover {
padding: 0px 0px 0px 30px;
}
.cover-image {
height: 250px;
display: flex;
align-items: center;
}
.whatToReadCover .description {
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 17;
-webkit-box-orient: vertical;
//height: 290px;
white-space: normal;
width: 238px;
padding: 5px 0 0 0;
}
.whatToReadCover:first-child {
margin-left: 0;
}
.whatToReadCover:last-child {}
.more-info {
display: inline-block;
width: 162px;
border: 2px solid #20638f;
padding: 0.4em 0.6em;
color: #20638f;
text-decoration: none;
font-weight: 800;
font-size: 0.9em;
text-transform: uppercase;
margin: 12px 0 0 0;
float: left;
}
什麼div?邊界,高度和寬度從哪裏來? –
無論如何,重要的是'垂直對齊'和'顯示'屬性 –