Home > DeveloperSection > Forums > how to set text vertically middle using css ?
Takeshi Okada
Takeshi Okada

Total Post:89

Points:629
Posted on    February-26-2013 4:06 AM

 CSS-CSS3 CSS-CSS3 
Ratings:


 1 Reply(s)
 1151  View(s)
Rate this:

Hi Expert!

I have two control within div, one is checkbox and other one is label. I want to set label as vertically middle. I have used vertical-align:middle and text-align:center; but this is not worked.
Please help me!

my code as below

<div>
    <input type="checkbox" id="chk" style="width: 25px; height: 25px; background-color:#E5E5E5;" />
    <label for="chk" id="lblChk">
        Product</label>
</div>

Any suggestion will be appreciated!

Thanks in advance.



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    February-26-2013 7:52 AM

Hi Takeshi!

Try this way

vertical-align:super;

Your modify code as below

<div>
    <input type="checkbox" id="chk" style="width: 25px; height: 25px; background-color:#E5E5E5;" />
    <label for="chk" id="lblChk" style="vertical-align:super;">
        Product</label>
</div>


Don't want to miss updates? Please click the below button!

Follow MindStick