Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap: vertically align paragraph text and buttons

I have text in a paragraph with a button a element:

<p>
  <a class="btn btn-default" href="#">Take exam</a> 
  <span class="text-muted">Available after reading course material</span>
</p>

However, this renders with the two not vertically aligned.

enter image description here

What is the best way to align the text baseline here?

Fiddle at http://jsfiddle.net/0j20stbh/

like image 726
William Entriken Avatar asked Aug 25 '14 16:08

William Entriken


1 Answers

Using the same styling as the .btn would probably be a good approach. Example with disabled .btn

<p>
    <a class="btn btn-default" href="#">Take exam</a> 
    <span class="text-muted btn" disabled="true">Text</span>
</p>


Or make a class of .btn-align with the same attributes. Example

CSS

.btn-align {
    padding: 6px 12px;
    line-height: 1.42857143;
    vertical-align: middle;

}

HTML

<p>
  <a class="btn btn-default" href="#">Take exam</a> 
  <span class="text-muted btn-align">Available after reading course material</span>
</p>
like image 98
im_brian_d Avatar answered Sep 20 '22 15:09

im_brian_d