K V
K V

Reputation: 578

Align label in middle of textarea in separate divs

I have following code and I want to make my label to be alligned in middle near textarea:

<div class="form-group">
    @Html.Label("Message", new { @class = "col-md-2 control-label" })
    <div class="col-md-6">
        @Html.TextArea("Message", new { @class = "form-control", rows = 10, style="vertical-align:middle;"})
    </div>
</div>

It still appears at top of textarea...

P.S In single div it works fine, but I have to remove form-control and col classes... Here's code which makes label aligned in middle near textarea:

<div class="form-group">
    <div class="col-md-6">
        @Html.Label("Message", new { @class = "control-label" })
        @Html.TextArea("Message", new { rows = 10, style="vertical-align:middle;"})
    </div>
</div>

Any ideas how to make that alignment without changing divs and classes of the first code?

Upvotes: 0

Views: 257

Answers (1)

thispatchofsky
thispatchofsky

Reputation: 854

Not sure if it's possible without an intervention using margins. The following should give you what you are looking for :

<div class="form-group">
    @Html.Label("Message", new { @class = "col-md-2 control-label", @style="margin-top: 80px" })
    <div class="col-md-6">
        @Html.TextArea("Message", new { @class = "form-control", rows = 10, style="vertical-align:middle;"})
    </div>
</div>

Upvotes: 1

Related Questions