I created a panel heading in bootstrap and tried to center its text while having a button that's supposedly on the same horizontal axis as the text but pulled in the right but my output was:
Here's my code:
<div class='container'>
<div class='panel panel-default'>
<div class='panel-heading'>
<div class='panel-heading text-center'>
<h4>Present Schedule<button class='btn pull-right btn-danger' onclick="location.href='past_sched.php'">Go to Past Schedule</button></h4>
</div>
</div>
</div>
</div>
Here's a jsfiddle of the result: https://jsfiddle.net/63c0wn66/3/
Try this code. Put button outside h4
HTML
<div class='container'>
<div class='panel panel-default'>
<div class='panel-heading text-center panel-relative'>
<button class='btn btn-danger btn-right' onclick="location.href='past_sched.php'">Go to Past Schedule</button>
<h4>Present Schedule</h4>
</div>
</div>
</div>
CSS
.panel-relative{
position: relative;
}
.btn-right{
position: absolute;
right: 15px;
}
https://jsfiddle.net/63c0wn66/7/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With