简体   繁体   中英

CSS positioning and overflow:hidden

I have a #container div which wraps all content. And #slides-wrap div which is inside #container . I don't know width of #sliders-wrap , but I know size of every .slide in it (slides number are unbounded). Also part of #slides-wrap that overflows screen must be hidden. See attached image as example.

Is it real to do?

在此处输入图片说明

Yes, it is possible, you just need to give your #slides-wrap with following properties

display: inline
white-space: nowrap;

Check this out: http://jsfiddle.net/sv3a4522/

set z-index for div:

#container
{
    overflow:hidden;
    z-index:2;
    position: relative;
    width: your-value
}

#container #slides-wrap
{
    width:your-value; /*(1000px or more)*/
    z-index:1;
    position: relative;
}

#slides-wrap .slide
{
    width:100px /*your value*/
}

Demo: 演示:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM