Issue
on the class h-50 how would I align the text to the bottom of the div using bootstrap 4
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div style='height:300px;border:1px solid #333;'>
<div class="bg-primary d-inline-block h-25">Height 25%</div>
<div class="bg-primary d-inline-block text-bottom h-50"><span class='text-bottom'>Height 50%</span></div>
<div class="bg-primary d-inline-block h-75">Height 75%</div>
<div class="bg-primary d-inline-block h-100">Height 100%</div>
<div class="bg-primary d-inline-block h-auto">Height Auto</div>
</div>
Solution
One possibility within Bootstrap 4 would be to use d-inline-flex flex-column
on the h-50 div and then to use d-flex align-items-end h-100
on a div that wraps the span you want to align at the bottom:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<div style='height:300px;border:1px solid #333;'>
<div class="bg-primary d-inline-block h-25">Height 25%</div>
<div class="bg-primary d-inline-flex flex-column h-50">
<div class="bg-secondary d-flex align-items-end h-100">
<span>Height 50%</span>
</div>
</div>
<div class="bg-primary d-inline-block h-75">Height 75%</div>
<div class="bg-primary d-inline-block h-100">Height 100%</div>
<div class="bg-primary d-inline-block h-auto">Height Auto</div>
</div>
Answered By - Fab2 Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.