Last active
August 29, 2015 14:26
-
-
Save tobynet/137f49722ff587a57eea to your computer and use it in GitHub Desktop.
Align a button to bottom side in div
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="big-box"> | |
<div class="wrap-vertical-center"> | |
<button class="btn">Center Button</button> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* もっとも外側のdiv */ | |
.big-box { | |
/* 外側は relative の必要あり */ | |
position: relative; | |
width: 100%; | |
height: 300px; | |
border: 4px dotted pink; /* for debug */ | |
} | |
/* wrapper の div */ | |
.wrap-vertical-center { | |
position: absolute; | |
width: 100%; | |
bottom: 15%; /* 下から基準に配置する */ | |
border: 4px dotted gray; /* for debug */ | |
} | |
/* ボタンの調整 */ | |
.wrap-vertical-center button { | |
display: block; | |
margin: 0 auto; /* 横で中心に寄せる */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment