Search code examples
asp.net.netcss.net-2.0radio-button

RadioButton Text style


I have the following markup:

where

.checkBoxImg input { vertical-align:top; margin-top:5px;}

and

this.rbtnAssessedNo.Text = "<img src='images/icons/icon_no.gif' /><span style=\"margin-top:5px; vertical-align:top\">No</span>";

I get RadioButtons text which is: img (27x27px) and text: NO(16x16px) on which margin-top:5px doesn't work and it is to hight relative to img. Also when i change vertical-align on it to middle it goes to the bottom of whole RadioButton span which is also wrong.

i'm aiming to get img and text NO that will be in the middle of img (more or less 5px from top will be ok). What am i doing wrong?


Solution

  • The span usually are line dependent and they are not like div's that are like boxes. So they tent to not keep the margin you set.

    Change it to div and use display:inline and the margin will be set.