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

查看:24
本文介绍了如何调整 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 并设置其字体大小,但它似乎忽略了这一点.因此,必须有某种方法可以通过更改其父项的字体来缩小日期选择器,但是如何在不弄乱我网站的其余部分的情况下做到这一点?

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;
}

在 ui 文件之后加载的样式表中

in a stylesheet loaded after the ui-files

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

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

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

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