不同颜色的飞出菜单
我正在为 MOSS 发布网站创建自定义母版页。 设计师们为飞出菜单提出了这个想法...
替代文本 http://www.abbeylegal.com/Downloads/2009-01-06/gradient%20menu.jpg
为每个菜单选项使用分级/不同的背景和文本颜色。
有谁知道如何做到这一点?
I'm creating a custom master page for a MOSS publishing site. The designers have come up with this idea for the fly out menu...
alt text http://www.abbeylegal.com/Downloads/2009-01-06/gradient%20menu.jpg
which uses graduated/different backgrond and text colours for each menu option.
Does anyone know how to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 CSS 下一个兄弟选择器 (+) 来实现此目的,但 IE6 不会获取样式。
执行如下操作(颜色属性仅作为示例):
或者,您必须将 CSS 类应用到每个向下的子项(如果您不对此负责,请与程序员交谈),或者通过使用 javascript 添加类。
理想情况下,请尝试让他们相信您无法在 IE6 上执行此操作,但现代浏览器可以很好地管理。 只要网站仍然可用,颜色渐变就是一个非常小的损失。
You can use the CSS next-sibling selector (+) to achieve this however IE6 won't get the styles.
Do something like the following (colour properties are just for example):
Alternatively, you'll have to either apply a CSS class to each subitem going down (talk to the programmer if you're not responsible for that), or do it by adding classes with javascript.
Ideally try to convince them that you can't do it for IE6 but modern browsers will manage fine. As long as the site is still usable the gradient of colours is a very minor loss.
我看到纯 css 有两种可能性:
1。
如果输入线的像素高度是固定的,那么您始终可以使用一张带有渐变的背景图像。 如果您使用列表制作菜单,则只需将其放在包含的列表标签上即可。
2.
如果您想保持行高/字体大小灵活,您可以使用多个类:每种色调一个。 只需给每个第 n 行一个特殊的类,并以相应的色调作为背景色,并将该类放在该行的标签上即可。
设计评论家:
我在这里看到的问题是,您将拥有最大数量的条目,因为在这种逐渐淡入淡出的水平下,背景颜色将在六到七个条目后变成白色。
美言:
只要菜单不必是透明的就应该没问题。
I see two possibilites with pure css:
1.
If you have fixed pixel height for the entry lines you could always use one single background image with the gradients on it. If you make your menus with lists you could just slap it on the encompassing list tag.
2.
If you want to to keep the line height/ font size flexible you can work with multiple classes: one for every color tone. Just give give every nth-line a special class with the corresponding color tone as a background color and slap that class on the tag for that line.
design critic:
The problem that I see here is that you will have a maximum number of entries because with this level of gradual fade the background color will become white after six or seven entries.
kind words:
As long as the menu doesn't have to be transparent you should be fine.
如果您希望能够计算任意颜色的渐变,此页面有一些有用的函数处理十六进制颜色三元组计算。
If you want to be able to calculate a gradient of arbitrary colors, this page has some useful functions for handling hex color triplet calculations.
我可能会使用 Suckerfish 方法,每个级别都有不同的 CSS 类 <菜单中的代码>
I would probably use the Suckerfish method with different a CSS class for each level of
<li>
in the menu:我发现这对于 Sharepoint 来说是不可能的
I found this not to be possible with the Sharepoint