stas-webdev stas-webdev - 4 months ago 7x
CSS Question

HTML/CSS create body wider than viewport

I'll trying to create website with horizontal scrolling.
But when I set element wider than viewport - body is do not wider.

Following code doesn't works

body {
float: left

How I can do body wider than viewport?

I create fiddle for this -

Update: I have a unknown num of .grid-cell blocks, in theory. So, I don't know, how wide should be body width in each case. It should be flexible.


If you have unknown number of cells then just add overflow property on your html, body. see below:

html, body {
  position: relative;
  height: 100%;
  background: red;
  overflow: auto;