w3.org网站上,这个效果是怎么做D呢

2011 年 5 月 11 日
 AntiGameZ
http://img.ly/3Zwm

源地址是 http://dev.w3.org/html5/spec/Overview.html#the-nav-element

Firebug看了一下,下面的dl没有什么神奇之处,但是上面凸出来的一块却找不到生成样式的代码,好奇怪。求帮助
5371 次点击
所在节点    问与答
13 条回复
Hyperion
2011 年 5 月 11 日
红色的那块?... 是带fixed样式的背景图片吧
xiluo
2011 年 5 月 11 日
有可能是html5的新特性就支持呢
AntiGameZ
2011 年 5 月 11 日
@Hyperion 我也以为是,但是看了并没有设置背景图

@xiluo 应该不是的
napoleonu
2011 年 5 月 11 日
.element:before {
position: absolute;
z-index: 2;
top: 0;
left: -1.15em;
height: 2em;
width: 0.9em;
background: #EEEEFF;
content: ' ';
border-style: none none solid solid;
border-color: #9999FF;
border-width: 0.25em;
}
napoleonu
2011 年 5 月 11 日
h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }

再结合这一行,就把h4放在了凸出来的那一行了。
AntiGameZ
2011 年 5 月 11 日
@napoleonu 啊,真是感谢,我来玩玩瞧
Hyperion
2011 年 5 月 11 日
@napoleonu
原来指的是这里 =3=

content: " "; 在div之前添加了一个空格, 原理和after消除浮动一样. 囧
xhinking
2011 年 5 月 11 日
@napoleonu 说的对,Firebug看不到 .element:before ,要直接到源代码里查看。
napoleonu
2011 年 5 月 11 日
嘿嘿,用Chrome Inspect element很方便。
heckthisplace
2011 年 5 月 11 日
看半天没找到楼主说的地方。
AntiGameZ
2011 年 5 月 11 日
@Hyperion 这个办法相当的tricky啊
holystrike
2011 年 5 月 11 日
@napoleonu 加号表示什么意思啊
napoleonu
2011 年 5 月 11 日
@holystrike 相邻兄弟选择器(Adjacent Sibling Selectors)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/12892

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX