CSS菜单 - 更改选项卡的颜色 - 我是否需要每种颜色的css文件?更好的方法? [英] CSS menu - changing colors of tab - do I need a css file for each color? a better way?
问题描述
嗨
我正在制作一个带有CSS的标签菜单,并且标签会改变颜色,具体取决于
在哪个标签上是最新的。
1.我可以为每个标签/颜色加载不同的css文件。
2.我只能为标签的颜色做一些内联css。 (我将通过php改变
)。
3.我可以为每种颜色制作一个不同的类,并更改班级
$ b $选项卡的b。
但有一种方法可以使智能 css,所以你在css
文件中可以做一些如果bode类是class = body one,那么颜色
af tab应该是xxx?
我想到这条线上的东西 -
body.section-1 td.menu,
{
背景:#fff;
}
body.section-2 td.menu,
{
背景:#444;
}
body.section-2 td.menu ,
{
背景:#444;
}
所以我只需要改变身体类的名称,并为每种颜色制作一个部分
?
好吧,我只是对我的建议有所了解
body.section-1 td.menu {
background-color:#ff0000;
}
body.section-2 td.menu {
background-color:#0000ff;
}
任何身体都有更好的想法吗?
希望这会起作用
body.section-1 td.current,td.submenu,td.bredtsubmenumellemrumhojre,
td .bredtsubmenumellemrumvenstre {
background-color:#ff0000;
}
body.section-2 td.current,td。 submenu,td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color:#ffc233;
}
但它不起作用。
ma ************ @ gmail.com 写道:
希望这会起作用
body.section-1 td.current,td.submenu,td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color:#ff0000;
}
body.section-2 td.current,td.submenu,td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color:#ffc233;
}
>但它不起作用。
在我的脑海里编译你原来的问题,你的后续行动,以及这个
的消息,我想这是:
>
使用您的解决方案编号2.
请检查哪个页面是当前页面,然后添加
''class =" current"' '到需要改变颜色的td。
然后在样式表中设置td.current样式。
-
Els http://locusmeus.com/
Sonhos vem 。 Sonhos v?o。 Orestoébritfeito。
- Renato Russo -
现在玩:Pearl Jam - 为什么要去
Hi
I am making a tab menu with css, and the tabs changes color depending
on wich tab is current.
1. I could load a different css file for each tab/color.
2. I could do some inline css only for the color of the tabs. (which I
would then change with trough php).
3. I could make a different class for each color, and change the class
of the tab.
But there a way to make a "intelligent" css, so that you in the css
file could do some sort of if bode class is class=body one, then colour
af tabs should be xxx?
I am thinkin of something along this line -
body.section-1 td.menu,
{
background : #fff;
}
body.section-2 td.menu,
{
background : #444;
}
body.section-2 td.menu,
{
background : #444;
}
so i would only need to change name of body class and make a section
for each color?
解决方案well I just treid my on suggestions a that works
body.section-1 td.menu {
background-color: #ff0000;
}
body.section-2 td.menu {
background-color: #0000ff;
}
Any body got better ideas?
Had hoped this would work
body.section-1 td.current, td.submenu, td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color: #ff0000;
}
body.section-2 td.current, td.submenu, td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color: #ffc233;
}
but it does not work.
ma************@gmail.com wrote:
Had hoped this would work
body.section-1 td.current, td.submenu, td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color: #ff0000;
}
body.section-2 td.current, td.submenu, td.bredtsubmenumellemrumhojre,
td.bredtsubmenumellemrumvenstre {
background-color: #ffc233;
}
but it does not work.
compiling in my mind your original question, your follow-up, and this
message, I think this:
Use your solution number 2.
Have php check which page is the current one, and make it add
''class="current"'' to the td that needs to have a change of colour.
Then style td.current in your stylesheet.
--
Els http://locusmeus.com/
Sonhos vem. Sonhos v?o. O resto é imperfeito.
- Renato Russo -
Now playing: Pearl Jam - Why Go
这篇关于CSS菜单 - 更改选项卡的颜色 - 我是否需要每种颜色的css文件?更好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!