jquery ui tabs 主要风格变化

发布于 2024-08-25 14:07:48 字数 304 浏览 9 评论 0原文

我正在使用 jquery UI 选项卡,我需要主要更改它的样式。我需要重新调整背景图像、边框,几乎所有内容。我需要它看起来最小,而不是像它是独立的。

最好的方法是什么?然而,我需要使用日历小部件的默认 UI 样式,该样式位于同一页面上。我做了很多研究,每个人似乎都指向主题滚轮。但是,我不仅仅是想更改颜色和边框半径。我需要删除废话。 theme-roller 似乎只是改变颜色之类的东西(对现实世界来说并不是很有用)。如何在不更改同一页面上其他 UI 小部件的样式的情况下调整选项卡的 css(我希望日历保持原样)?

我的选项卡是否值得使用 jquery UI?

I am using jquery UI tabs and I need to majorly change the styling on it. I need to rempve the background image, the borders, almost everything. I need it to look minimal, and not like it's self contained.

What's the best way to do this? I need to use the default UI styling for the calendar widget however, which is on the same page. I've done a lot of research and everyone seems to point to the theme-roller. However, i do not just want to change the colors and border radii. I need to delete crap. theme-roller seems to be just change things like colors (not really useful for the real world). How do I adapt the css for the tabs without changing the styles of the other UI widgets on the same page (I want the calendar to stay as it is)?

Is it even worth using jquery UI for my tabs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

站稳脚跟 2024-09-01 14:07:48

您应该查看 Keith Wood 关于设置 JQuery UI 选项卡样式的详细博客文章。

您的具体问题的答案

我需要重新调整背景图像、边框,几乎所有内容。
我需要它看起来最小

在 Keith Wood 帖子的“删除大部分格式”部分中。

除此之外,还有 10 处样式更改,以及实现所需效果所需的 CSS。

JQuery UI 选项卡样式 - Keith Wood 博客文章

You should check out Keith Wood's detailed blog post on styling JQuery UI Tabs.

The answer to your specific question

I need to rempve the background image, the borders, almost everything.
I need it to look minimal

is in this section "Remove most of the formatting" of Keith Wood's post.

In addition to this, there are 10 more style changes, complete with the CSS required to achieve the desired effect.

JQuery UI Tabs Styling - Keith Wood Blog Post

预谋 2024-09-01 14:07:48

当我意识到我不需要它的大部分内置功能(例如加载 AJAX 内容和动态添加/删除选项卡)时,我选择编写自己的简单选项卡功能。如果我需要这些功能,我自己实现它们会很容易。促使我放弃 jQuery UI 选项卡的原因是我必须以不同的方式构建 DOM 元素。我还需要将我的选项卡设计得看起来最小,而且我认为从头开始构建比尝试剥离很多东西要省力。

我最怀念的功能是 jQuery UI Tabs 如何自动选择 URL 中 # 指示的选项卡(我知道我可以复制它 - 只是还没有得到它)​​。


更新:但是,是的,如果你坚持使用它,你可以使用你拥有的任何 ID 覆盖 CSS:

#my-tabs .ui-state-default {
    background-image: none; /* remove default bg image */
}

等等。

I chose to write my own simple tabs functionality when, I realized that I didn't need most of its built-in features, such as loading AJAX content and dynamic adding/removing of tabs. If I needed those features, it would be easy to implement them myself. What pushed me to ditch jQuery UI Tabs is that I had to structure my DOM elements differently. I also needed to style my tabs to look minimal, and I thought that building from scratch would be less effort than trying to strip away a lot.

The feature I miss the most is how jQuery UI Tabs automatically selects the tab indicated by the # in the URL (I know I can just copy it -- just haven't gotten to it yet).


UPDATE: But, yeah, if you're sticking with it, you can override the CSS using any IDs you have:

#my-tabs .ui-state-default {
    background-image: none; /* remove default bg image */
}

and so on..

烟火散人牵绊 2024-09-01 14:07:48

在您的 css 中尝试以下操作,假设您的类是 .mytabs 作为重写 css。它应该让你开始

.mytabs li {
        background :  white !important;
        border-top: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important; 

    }
    .mytabs li.ui-state-active {
        background :  white !important;
        border-top: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important; 
        margin: 0;


    }

.mytabs li a 
    {
        color:          Black !important;
        font-size:      1.4em !important;
        font-weight:    bolder;
        padding:        4px 1.5ex 3px !important;
    }

Try the following in your css assuming your class is .mytabs for the overriding css. It should get you started on

.mytabs li {
        background :  white !important;
        border-top: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important; 

    }
    .mytabs li.ui-state-active {
        background :  white !important;
        border-top: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important; 
        margin: 0;


    }

.mytabs li a 
    {
        color:          Black !important;
        font-size:      1.4em !important;
        font-weight:    bolder;
        padding:        4px 1.5ex 3px !important;
    }
鸢与 2024-09-01 14:07:48

使用一些 CSS,您可以轻松地覆盖 jQuery UI 提供的标准 CSS。如果修改后的 CSS 出现在 jQuery UI CSS 之后,您可能不需要 !important。

您还可以在加载时使用 jQuery 向每个元素删除/添加类,但这似乎有点不必要。

It's easy with some CSS you can easily override the standard CSS delivered with jQuery UI. You may not need !important if your modified CSS appears after the jQuery UI CSS.

You can also remove/add classes to each element with jQuery on load, but that seems a bit unnecessary.

心凉 2024-09-01 14:07:48

使用 CSS 应该相当简单。您的元素上有 ID 和类,您可以使用 CSS 来触摸它们。 Themeroller 只是一个快速使用的东西。

如果我记得的话,您还可以调整选项卡 js 并调整添加图像的行(如果这是同一个插件),或者根据您的喜好完全删除该行。

It should be fairly straightforward with CSS. Your elements have IDs and classes on them and you can touch them with CSS. Themeroller is just a quick go-to thing.

If I recall, you could also adjust the tabs js and adjust the lines that add images (if this is the same plugin) or just remove that line altogether to your liking.

倥絔 2024-09-01 14:07:48

我想知道 !important 属性是否应该首先出现在默认的 jquery ui 模板中。例如,如果您将选项卡更改为左侧或右侧而不是顶部,则“border-bottom”不应该有 !important,因为这通常会被覆盖。

I wonder if the !important attributes should be in the default jquery ui templates in the first place. For example, if you change the tabs to be on the left or right side instead of top, the 'border-bottom' shouldn't have a !important, since this is commonly overwritten.

苍风燃霜 2024-09-01 14:07:48

这里几乎涵盖了所有内容,但我环顾四周,找到了一种方法,可以用一个类轻松地扔掉你真正不需要的东西,然后编辑其余的属性。

*[class*="ui-"] {
     border-radius:0;
     background-image: none;
     .
     .
     .
}

这样,您可以选择以“ui-”开头的每个类,并删除您想要从 jQuery UI 中删除的任何内容。

Almost everything is covered here, but I was looking around and found a way to toss things you really don't need quite easily with a single class, while then editing the remaining attributes.

*[class*="ui-"] {
     border-radius:0;
     background-image: none;
     .
     .
     .
}

This way you select every class that starts with "ui-" and remove whatever you want to remove from jQuery UI.

银河中√捞星星 2024-09-01 14:07:48
 #my-tabs * {
    background-image: transparent;
}
 #my-tabs * {
    background-image: transparent;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文