更改 jquery 日期选择器的高度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5669502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing the height of a jquery datepicker
提问by Stanley Cup Phil
I am trying to change the height of a datepicker I am using. I have been working through firebug and was able to change the width by editing the ui-datepicker
class like so:
我正在尝试更改我正在使用的日期选择器的高度。我一直在处理 firebug 并且能够通过ui-datepicker
像这样编辑类来更改宽度:
.ui-datepicker
{
width: 12em;
height: 12em;
}
The width works fine, but the height only changes the back of the calender, and not the cells so I end up with something like this:
宽度工作正常,但高度只会改变压光机的背面,而不是细胞,所以我最终得到了这样的结果:
Where the height of the datepicker background has changed, but the cells are the same. In the class .ui-datepicker table
I tired to add a line of code height: 80%
, but the height will not go lower then 100% (or at least any lower will not change the appearance of the datepicker). I have been looking through the css to try to find where the height is set, but cannot find it so far.
Any suggestions?
日期选择器背景的高度已更改,但单元格相同。在课堂上.ui-datepicker table
我累了添加一行代码height: 80%
,但高度不会低于 100%(或至少任何更低都不会改变日期选择器的外观)。我一直在查看 css 以尝试找到设置高度的位置,但到目前为止找不到。有什么建议?
回答by ChrisThompson
i got it smaller changing the following two lines. i changed width on the datepicker from 14 to 12em; and set the font to .7em.
我把它变小了,改变了以下两行。我将日期选择器的宽度从 14 更改为 12 em;并将字体设置为 .7em。
.ui-datepicker { width: 12em; padding: .2em .2em 0; display: none; }
.ui-datepicker table {width: 100%; font-size: .7em; border-collapse: collapse; margin:0 0 .4em; }
回答by Arun Duth
Following steps helped me.
以下步骤帮助了我。
- Open CSS file 'jquery-ui.css' from \Content\themes\base\
- Move to section 'jQuery UI Datepicker 1.8.7'
- Change Width and Height property for following items as per requirement
.ui-datepicker
.ui-datepicker table
.ui-datepicker th
.ui-datepicker td
.ui-datepicker td span .ui-datepicker td a
- 从 \Content\themes\base\ 打开 CSS 文件“jquery-ui.css”
- 移至“jQuery UI Datepicker 1.8.7”部分
- 根据要求更改以下项目的宽度和高度属性 .ui-datepicker .ui-datepicker table
.ui-datepicker th
.ui-datepicker td
.ui-datepicker td span .ui-datepicker td a
Here is the modified UI http://arunduth.net/Images/JQueryDatePicker.png
回答by scottpetrovic
The date picker has a few different elements inside of it that affect the height. There is no good selector that I have found that scales the whole thing up.
日期选择器内部有一些影响高度的不同元素。我发现没有好的选择器可以放大整个事情。
You mention making the cells larger. For that, you can target the anchor tags inside of the date picker.
你提到使细胞变大。为此,您可以定位日期选择器内的锚标记。
.ui-datepicker td a
{
height: 1.4em;
}
Doing something like that will make all of the cells bigger and the entire datepicker window will auto expand. Note that increasing the height this selector will not change the width. Trying to add a "width" property to this selector will create unwanted padding. You will have to do it how you originally were doing it.
这样做会使所有单元格变大,整个日期选择器窗口将自动展开。请注意,增加此选择器的高度不会改变宽度。尝试向此选择器添加“宽度”属性将创建不需要的填充。你将不得不按照你最初的方式去做。
.ui-datepicker
{
width: 12em;
}
回答by Hindu
Do just this. Height would be taken care of automatically
只做这个。高度会自动处理
.ui-datepicker {
width: 12em;
font-size:10pt;
}
回答by Daff
I think you have to specifically change the height of the table cells, e.g. like this:
我认为您必须专门更改表格单元格的高度,例如:
.ui-datepicker td {
height: 1em;
}
Which will also adjust the height of the sorrounding date picker.
这也将调整周围日期选择器的高度。
回答by Shakir
Even smaller than the answer given:
甚至比给出的答案还要小:
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 0.7em; }
Change the font-size, everything changes
改变字体大小,一切都会改变
回答by Aman
If it is an inline datepicker,then there is a trick.
Just give some id to datepicker .<div id="datepicker" ></div>
.
Now change the font-size of datepicker according to your need. It will automatically change the size of datepicker.
css code:
#datepicker{
font-size: 20px;
}
如果它是内联日期选择器,则有一个技巧。只需给 datepicker 一些 id 。<div id="datepicker" ></div>
. 现在根据需要更改 datepicker 的字体大小。它会自动更改日期选择器的大小。css代码:
#datepicker{
font-size: 20px;
}
回答by Ashwini Verma
回答by oritadeu
I can't vote, then here is mine
我不能投票,那么这是我的
#dataAgenda2 .ui-widget { font-size: 0.8em !important; }