how can I align text/image/links within a grid <div> of the twitter bootstrap css?

最后都变了- 提交于 2019-12-23 14:54:01

问题


I am trying to use Twitter's bootstrap CSS framework and within there so far only the grid layout. Now I simply want to align the content of each grid cell <div> to the bottom. I am obviously no CSS buff at all.

This is the html:

<div class="container">
    <div class="row">
        <div class="span4">
            <a href="index.php"><img src="someprettyhighimage.gif"/></a>
        </div>
            <div class="span8">
                some text/links that need to be bottom aligned
            </div>
        </div
    </div>
</div>

I cannot find a way to make the second column <div> with the text (and/or the first) be bottom aligned.

Does anybody know the css magic I would need for that? (Or also how I would make both <div>s bottom-aligned?

Thanks a lot,

Sebastian


回答1:


You need to set the position property of the class="row" div to relative and then set the position property of the div containing text to absolute and the bottom property to 0.

.row { position: relative; }
.span8 { position: absolute; bottom: 0; }

Check it out on jsfiddle:

http://jsfiddle.net/A8XE2/



来源:https://stackoverflow.com/questions/9455927/how-can-i-align-text-image-links-within-a-grid-div-of-the-twitter-bootstrap-cs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!