html - 对齐最后一个 div 元素

标签 html css

我尝试使用 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/

相关文章:

javascript - 样式动态添加表头和列

html - 将滚动条更改为 div 的左侧

javascript - 具有视差效果的 DIV 叠加层

python - 有没有办法在 django 模板中使用 'and' 来检查 2 个变量?

javascript - 带 + 和 - 符号的可折叠列表不起作用

html - 仅在 Webkit 浏览器中以中心为中心的菜单丢失元素

html - 是否可以内联应用 CSS 过渡?

html - django allauth 自定义消息 : Styling messages with html/css

html - 是什么导致这些 SVG/CSS 动画在某些浏览器中中断?

javascript - 使用位置 :fixed with no overlapping? 的正确方法是什么