垂直居中标签内的文本

时间:2013-01-11 05:08:17

标签: css

以下示例适用于Chrome,但不适用于FF或IE。我试图垂直居中“选项1”和“选项2”。有人能把我推向正确的方向吗?

HTML

<div id="polls-4" class="wp-polls">
    <form id="polls_form_4" class="wp-polls-form" action="/sandbox/our-girls/" method="post">
        <p style="display: none;"><input type="hidden" id="poll_4_nonce" name="wp-polls-nonce" value="eeb4f4642f"></p>
        <p style="display: none;"><input type="hidden" name="poll_id" value="4"></p>
        <div id="polls-4-ans" class="wp-polls-ans"><ul class="wp-polls-ul">
        <li><input type="radio" id="poll-answer-13" name="poll_4" value="13"> <label for="poll-answer-13"><img src="http://i.minus.com/iCKua5u7mVHHA.gif">Option 1</label></li>
        <li><input type="radio" id="poll-answer-14" name="poll_4" value="14"> <label for="poll-answer-14"><img src="http://i.minus.com/iCKua5u7mVHHA.gif">Option 2</label></li>
        </ul>
    </form>
</div>

CSS

.wp-polls-ul { margin:0 !important }
.wp-polls-ul li { margin-bottom:10px }
.wp-polls-form .wp-polls-ul li input { float:left;height:35px;margin-right:10px }
.wp-polls-form .wp-polls-ul li label { display:block;height:35px;line-height:35px;vertical-align:top }
.wp-polls-form .wp-polls-ul li label img { margin-right:10px }

示例:http://jsfiddle.net/tePwt/

3 个答案:

答案 0 :(得分:0)

@Passerby提交的

将为Firefox生成项目符号,只需稍加修改即可尝试。 [http://jsfiddle.net/tePwt/5/]

答案 1 :(得分:0)

@John使用这个jsfiddle.net/tePwt/7/我希望这对你有帮助。

答案 2 :(得分:0)

延伸评论:

添加

vertical-align:middle

imgJSFiddle demo