如何在 Jquery 中仅更改 Div 标签的标题背景颜色
我在使用 JQuery 构建的模式对话框中有一个 div 标签,如下所示: div id="dialogxxxx" title="xxxxx" 。我只想单独更改标题的字体和背景颜色,即仅更改标题显示的位置。现在它有默认的颜色和字体。我想将其更改为特定颜色,但不想更改整个div的背景颜色和字体,只想更改显示标题的地方。有办法做到这一点吗?我尝试向 div 添加样式标签,但这会更改整个 div 的背景颜色,而不仅仅是标题。我也尝试过做 div#title,但这也没有帮助。
非常感谢任何指示/帮助。
谢谢,
阿莎
I have a div tag in my modal dialog built using JQuery like this: div id="dialogxxxx" title="xxxxx" . I want to just change the font and background color of the title alone, i.e. only the place where the title is displayed. Right now it has a default color and font. I want to change it to a specific color, but do not want to change the background color and font of the entire div, just the place where the title is displayed. Is there a way to do this? I tried adding style tag to the div, but that changes the background color of the entire div, not the title alone. I also tried doing div#title, that didnt help either.
Any pointer/help is greatly appreciated.
Thanks,
Asha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要一种快速而肮脏的方式,您可以简单地覆盖
.ui-widget-header
css 规则,例如查看此操作:http://jsfiddle.net/william/NgVAu/。
如果您想要一种更易于维护的方法,您应该使用 ThemeRoller,配置“标题/工具栏”部分。如果打开 css 文件,您可以找到 ThemeRoller 的 URL 及其所使用的主题。它位于“查看和修改此主题”之后的第二批评论中,例如
If you want a quick-n-dirty way, you can simply override the
.ui-widget-header
css rule, e.g.See this in action: http://jsfiddle.net/william/NgVAu/.
If you want a more maintainable approach, you should use the ThemeRoller, configuring the "Header/Toolbar" section. If you open up your css file, you can find a URL to the ThemeRoller with the theme it's using. It is located in the second lot of comment, after "To view and modify this theme", e.g.