在运行时改变一个jQuery Mobile的按钮,字体大小 [英] Change font size of a jQuery Mobile button at runtime

查看:716
本文介绍了在运行时改变一个jQuery Mobile的按钮,字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery Mobile的1.1.1的变化是如何形成的按钮。 previously,我可以设置按键的字体大小是这样的:

jQuery Mobile 1.1.1 changes how buttons are formed. Previously, I could set the font size of buttons like this:

<div id="Button1" data-role='button' data-inline=true data-theme=c 
 data-icon=false data-iconpos=none style="font-size:12px;">Button</div>

字体大小属性在1.1.1被忽略。它借鉴使用默认字体大小(16px的?)。我可以加入这一行code的改变字体大小:

The font size attribute is being ignored in 1.1.1. It draws with the default font size (16px?). I can change the font size by adding this line of code:

$('#Button1').children().children().css('font-size','12px');

但现在文本的垂直对齐方式是关闭的:它与原来的字体大小的文本的下边界对齐

But now the vertical alignment of the text is off: it aligns with the original font size text's lower boundary.

任何想法?

推荐答案

这将字体大小设置:

$('#Button1').children().children().css('font-size','12px')

要居中文本,你也想改变填充:

To center the text, you will also want to change the padding:

$('#Button1').children().css('padding','6px')

(使用jQuery Mobile 1.2测试)

(tested with jQuery Mobile 1.2)

这篇关于在运行时改变一个jQuery Mobile的按钮,字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆