AntiGameZ
V2EX  ›  问与答

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

  •  
  •   AntiGameZ · May 11, 2011 · 5570 views
    This topic created in 5655 days ago, the information mentioned may be changed or developed.


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

    Firebug看了一下,下面的dl没有什么神奇之处,但是上面凸出来的一块却找不到生成样式的代码,好奇怪。求帮助
    13 replies  •  1970-01-01 08:00:00 +08:00
    Hyperion
    Hyperion
    May 11, 2011
    1
    红色的那块?... 是带fixed样式的背景图片吧
    xiluo
    xiluo
    May 11, 2011
    2
    有可能是html5的新特性就支持呢
    AntiGameZ
    AntiGameZ
    OP
    May 11, 2011
    3
    @Hyperion 我也以为是,但是看了并没有设置背景图

    @xiluo 应该不是的
    napoleonu
    napoleonu
    May 11, 2011
    4
    .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
    napoleonu
    May 11, 2011
    5
    h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }

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

    content: " "; 在div之前添加了一个空格, 原理和after消除浮动一样. 囧
    xhinking
    xhinking
    May 11, 2011
    8
    @napoleonu 说的对,Firebug看不到 .element:before ,要直接到源代码里查看。
    napoleonu
    napoleonu
    May 11, 2011
    9
    嘿嘿,用Chrome Inspect element很方便。
    heckthisplace
    heckthisplace
    May 11, 2011
    10
    看半天没找到楼主说的地方。
    AntiGameZ
    AntiGameZ
    OP
    May 11, 2011
    11
    @Hyperion 这个办法相当的tricky啊
    holystrike
    holystrike
    May 11, 2011
    12
    @napoleonu 加号表示什么意思啊
    napoleonu
    napoleonu
    May 11, 2011
    13
    @holystrike 相邻兄弟选择器(Adjacent Sibling Selectors)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1761 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 23:58 · PVG 07:58 · LAX 15:58 · JFK 18:58
    ♥ Do have faith in what you're doing.