如何调整jQuery DatePicker控件的大小 [英] How to resize the jQuery DatePicker control

查看:506
本文介绍了如何调整jQuery DatePicker控件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用jQuery DatePicker控件.我已经可以在表单上使用它了,但是它大约是我想要的两倍,并且是jQuery UI页面上演示的1.5倍.我缺少一些简单的设置来控制尺寸吗?

I'm using the jQuery DatePicker control for the first time. I've got it working on my form, but it's about twice as big as I would like, and about 1.5 times as big as the demo on the jQuery UI page. Is there some simple setting I'm missing to control the size?

编辑:我找到了一个线索,但这带来了新的问题.在CSS文件中,它声明组件将根据父元素的字体大小进行缩放.他们建议设置

I found a clue, but it opens up new problems. In the CSS file, it states the component will scale according to the parent element's font size. They recommend setting

body {font-size: 62.5%;}

使1em = 10px.这样做为我提供了一个大小适中的日期选择器,但很显然,它弄乱了我的网站的其余部分(我目前的字体大小为.9em).

to make 1em = 10px. Doing this gives me a nicely sized datepicker, but obviously it messes up the rest of my site (I currently have font-size: .9em).

我尝试在文本框周围放置DIV并设置其字体大小,但似乎忽略了这一点.因此,必须有某种方法可以通过更改其父字体来缩小datepicker,但是如何做到这一点而又不弄乱我网站的其余部分呢?

I tried throwing a DIV around my text box and setting its font size, but it seems to ignore that. So there must be some way to shrink the datepicker by changing the font of its parent, but how do I do that without messing up the rest of my site?

推荐答案

您不必在jquery-ui css文件中进行更改(如果更改默认文件可能会造成混淆),如果您添加

You don't have to change it in the jquery-ui css file (it can be confusing if you change the default files), it is enough if you add

div.ui-datepicker{
 font-size:10px;
}

在用户界面文件之后加载的样式表中

in a stylesheet loaded after the ui-files

如果在声明中的ui-datepicker之后提到ui-widget,则需要div.ui-datepicker

div.ui-datepicker is needed in case ui-widget is mentioned after ui-datepicker in the declaration

这篇关于如何调整jQuery DatePicker控件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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