我尝试使用 text-align-last
属性对齐最后一个 div 元素,但没有成功。我在中心有很多 divs,但我的页面在每个分辨率上都不同,所以我无法控制元素是否完美,它们都不会单独出现在最后一行左右,这就是为什么我想将它们左对齐。
fiddle :http://jsfiddle.net/ecn8c0pt/
我的网站图片:
最佳答案
添加以下 CSS 即可。
http://jsfiddle.net/ecn8c0pt/1/
#gallery h2{
margin: 0;
height: 80px; /*Added height for the Heading */
font-size: 1.1em;
font-weight: 300;
color: #33CCFF;
}
.project{
display: inline-block;
margin: 0 15px 40px;
width: 156px; //To show in jsfiddle i reduced the width.
text-align: left;
float: left; //MUST CHANGE: Once you align left it will automatically float to left. Also the number of count per row will depends on the window width and div width.
}
.project .thumbnail{
width: 156px;//To show in jsfiddle i reduced the width.
height: 144px;
border-radius: 3px;
}
关于html - 对齐最后一个 div 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26867169/