V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
reorx
V2EX  ›  问与答

CSS布局问题求教

  •  
  •   reorx · Jun 25, 2012 · 2972 views
    This topic created in 5055 days ago, the information mentioned may be changed or developed.
    如题,今天为了一个效果在布局上纠结了很久,尝试了两种不同的布局,虽然解决了问题,但却有些不知其所以然,大家帮忙看看吧。

    第一种布局:

    http://jsfiddle.net/reorx/q8ca6/1/




    第二种布局:

    http://jsfiddle.net/reorx/VwwMh/1/




    问题:在第一种布局中,为什么#sidebar会遮住#main的阴影部分?
    4 replies    1970-01-01 08:00:00 +08:00
    nikejaycn
        1
    nikejaycn  
       Jun 25, 2012   ❤️ 1
    z-index属性只针对position:relative/absolute元素有效
    reorx
        2
    reorx  
    OP
       Jun 25, 2012
    @nikejaycn 明白了,那么在第一种布局中如何让阴影不被sidebar遮住呢?
    cutehalo
        3
    cutehalo  
       Jun 25, 2012   ❤️ 1
    @reorx 给#sidebar加上position:relative;
    reorx
        4
    reorx  
    OP
       Jun 25, 2012
    @cutehalo 哎呀我真笨,1楼都说得很清楚了嘛,谢谢~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1300 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 17:18 · PVG 01:18 · LAX 10:18 · JFK 13:18
    ♥ Do have faith in what you're doing.