Bootstrap 3 Align Text To Bottom of Div

前端 未结 5 1787
-上瘾入骨i
-上瘾入骨i 2020-12-03 02:22

I\'m trying to get a setup in Bootstrap that would look something like this, where I have text aligned with the bottom of an image:

=========================         


        
5条回答
  •  时光取名叫无心
    2020-12-03 02:56

    I collected some ideas from other SO question (largely from here and this css page)

    Fiddle

    The idea is to use relative and absolute positioning to move your line to the bottom:

    @media (min-width: 768px ) {
    .row {
        position: relative;
    }
    
    #bottom-align-text {
        position: absolute;
        bottom: 0;
        right: 0;
      }}
    

    The display:flex option is at the moment a solution to make the div get the same size as its parent. This breaks on the other hand the bootstrap possibilities to auto-linebreak on small devices by adding col-sx-12 class. (This is why the media query is needed)

提交回复
热议问题