在选项卡内容 jquery ui 上丢失样式和 javascript

发布于 2025-01-08 09:03:59 字数 286 浏览 4 评论 0原文

我有这里问题。当我在选项卡中加载 div 的内容时,我会丢失与该内容关联的样式。正如您所看到的,最初,我的 #content div 内的段落是绿色的,但是在我通过单击选项卡 1 或选项卡 2 或选项卡 3 加载新内容后,我丢失了我在样式表中定义的样式:

#content p
{
    color: green;
}

任何知道为什么会发生这种情况吗?

I have this problem here. When I load the content of a div inside my tab, I lose the styles that was associated with that content. As you can see, initially, the paragraph inside my #content div is green, but after I load new content by clicking on Tab 1 or Tab 2 or Tab 3, I lose the styles that I have defined in my stylesheet saying that:

#content p
{
    color: green;
}

Any idea why this is happening?

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

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

发布评论

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

评论(2

岁月流歌 2025-01-15 09:03:59

这是因为选项卡包含在#content

,并且只有#content p应该是绿色的

This is because the Tabs are not contained within #content

And only #content p should be green

说不完的你爱 2025-01-15 09:03:59

在小提琴示例中,#content p 的 css 选择器不适用于选项卡内的内容,因此选项卡没有该样式。制定一个 CSS 规则,应用于您想要设置样式的选项卡中的内容。使用 Chrome 开发者工具 (F12) 或 Firefox Firebug 插件检查您想要设置样式的项目。

In the fiddle example, the css selector for #content p doesn't apply to the content inside the tabs, so the tabs don't have that style. Make a css rule that applies to the content within the tabs that you want to style. Use Chrome developer tool (F12) or Firefox Firebug plugin to inspect the items to you want to style.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文