开发者

Force content to flow horizontally

开发者 https://www.devze.com 2023-01-29 20:20 出处:网络
I\'m looking to force the content of a box that is dynamically centered vertically to flow horizontally instead of the usual vertical flow that will require scrolling up or down.

I'm looking to force the content of a box that is dynamically centered vertically to flow horizontally instead of the usual vertical flow that will require scrolling up or down.

#outerbox {
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Creating 2% margin on left & right then 3% on top and bottom */
#innerbox {
    height: 94%;
    margin: 0 2%;
    margin-top: -47%;
    position: absolute;
    top: 50%;
}

#content {
    height: 100%;
    min-height: 100%;
}

<div id="outerbox">
  <div id="innerbox">
    <div id="content">
      Content go开发者_JAVA技巧es here...
    </div>
  </div>
</div>

The problem is when I resize the browser window, instead of flowing right and have horizontal scrollbars, the content moves down beyond the centered box. Advice on what I'm doing wrong and solution?


Here is an example of creating a horizontally scrolling area with elements inside:

http://jsfiddle.net/6PupD/

The trick is the scrollable container has a width smaller than the object container. You will need to set the width of the object container large enough to hold all the elements.

Hope this helps.

Bob

0

精彩评论

暂无评论...
验证码 换一张
取 消