简体   繁体   English

jQuery UI选项卡,删除选项卡和选项卡内容之间的空格

[英]jQuery UI Tabs, remove whitespace between tabs and tab content

Using jQuery UI for my project and I can't seem to find the CSS to remove the 10 px or so white space between the actual tabs and the tab content. 对于我的项目使用jQuery UI,我似乎找不到CSS来删除实际选项卡和选项卡内容之间的10 px左右的空白。

Any help is appreciated. 任何帮助表示赞赏。

try this in your css file/definition 在您的CSS文件/定义中尝试一下

.ui-tabs .ui-tabs-nav li {    
    margin: 1px 0 0 0 !important;
}

You're going to want to target .ui-tabs .ui-tabs-panel and remove the top padding; 您将要定位.ui-tabs .ui-tabs-panel并删除顶部填充; here's the default styling for this selector: 这是此选择器的默认样式:

.ui-tabs .ui-tabs-panel {
display: block;
border-width: 0;
padding: 1em 1.4em;
background: none;

Here's a fiddle demonstrating a basic tabs widget with an example black box like the one in your picture. 这是一个小提琴,展示了一个基本的选项卡小部件,其中带有示例黑匣子,如您的图片中的黑匣子。

I'd strongly advise against using !important to override any styles, especially with regard to the jQuery UI widgets, as the script generates dynamic selectors with (in some cases) a high level of specificity. 我强烈建议您不要使用!important覆盖任何样式,尤其是有关jQuery UI小部件的样式,因为该脚本会生成具有(在某些情况下)高度特定性的动态选择器。

I wrote an article on Medium about how to style jQuery tabs; 在Medium上了一篇有关如何设置jQuery标签样式的文章 while not directly relevant to your existing problem, I do touch upon the specific dynamic classes for the widget. 虽然与您现有的问题没有直接关系,但我确实谈到了小部件的特定动态类。 If you're looking for further help, it might aid you in some way. 如果您正在寻找进一步的帮助,它可能会在某种程度上为您提供帮助。

Cheers! 干杯!

I finally fixed it, many wasted hours digging through CSS just to figure out that it was a freakin' <p></p> tag set in this line: tabs.append( "<div id='" + id + "'><p>" + tabContentHtml + "</p></div>" ); 我终于修复了它,花了很多时间在CSS上进行挖掘,只是弄清楚这是在此行中设置的一个怪胎的<p></p>标记: tabs.append( "<div id='" + id + "'><p>" + tabContentHtml + "</p></div>" );

All other answers were fine and I didn't post enough of a code sample to give anyone else a chance at a solution. 所有其他答案都很好,我发布的代码示例不足以给其他任何人解决的机会。 Was not sure who to award the answer to so I answered myself since this is what actually fixed the issue. 不确定是谁授予答案,所以我回答了自己,因为这实际上可以解决问题。

Thanks to the other folks who responded with info. 感谢其他以信息回复的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM