FrankO
FrankO

Reputation: 2562

Bootstrap alignment of label and regular text

I have been trying to get the text to properly align vertically with no luck. Could I get some assistance?

Alignment Problem

Here is the underlying code:

    <div class="form-group">
        <label class="control-label col-md-2">Permalink</label>
        <div class="col-md-10">
            http://www.somedomain.com/cart/@Model.Offer.Id
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Offer.DateCreated, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.DisplayFor(model => model.Offer.DateCreated)
            @Html.ValidationMessageFor(model => model.Offer.DateCreated)
        </div>
    </div>

Upvotes: 15

Views: 11344

Answers (2)

dlane
dlane

Reputation: 1131

Per Bootstrap docs, you can use <p class="form-control-static">[email protected]</p> to properly align static text in form groups.

Upvotes: 26

Morpheus
Morpheus

Reputation: 9065

You need to add display: inline or display: inline-block to your <div class="col-md-10"> in order for vertical-align to work.

Example

Upvotes: 0

Related Questions