I want to have one
use max-width instead of width
max-width:530px;
demo:http://jsfiddle.net/FPBWr/161/
Just set your width to auto:
#myWorkContent{
width: auto;
height:210px;
border: 13px solid #bed5cd;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;
}
This way your div can be as wide as possible, so you can add as many kitty images as possible ;3
Your div's width will expand based on the child elements it contains.
jsFiddle
Below worked for me.
Height & width are taken to show that, if you 2 such children, it will scroll horizontally, since height of child is greater than height of parent scroll vertically.
Parent CSS:
.divParentClass {
width: 200px;
height: 100px;
overflow: scroll;
white-space: nowrap;
}
Children CSS:
.divChildClass {
width: 110px;
height: 200px;
display: inline-block;
}
To scroll horizontally only:
overflow-x: scroll;
overflow-y: hidden;
To scroll vertically only:
overflow-x: hidden;
overflow-y: scroll;
I figured it this way:
* { padding: 0; margin: 0 }
body { height: 100%; white-space: nowrap }
html { height: 100% }
.red { background: red }
.blue { background: blue }
.yellow { background: yellow }
.header { width: 100%; height: 10%; position: fixed }
.wrapper { width: 1000%; height: 100%; background: green }
.page { width: 10%; height: 100%; float: left }
<div class="header red"></div>
<div class="wrapper">
<div class="page yellow"></div>
<div class="page blue"></div>
<div class="page yellow"></div>
<div class="page blue"></div>
<div class="page yellow"></div>
<div class="page blue"></div>
<div class="page yellow"></div>
<div class="page blue"></div>
<div class="page yellow"></div>
<div class="page blue"></div>
</div>
I have the wrapper at 1000% and ten pages at 10% each. I set mine up to still have "pages" with each being 100% of the window (color coded). You can do eight pages with an 800% wrapper. I guess you can leave out the colors and have on continues page. I also set up a fixed header, but that's not necessary. Hope this helps.
Just make sure you add box-sizing:border-box;
to your #myWorkContent
.
http://jsfiddle.net/FPBWr/160/