stas-webdev stas-webdev - 6 months ago 26
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 - https://jsfiddle.net/stas_webdev/9L1gLoww/

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.

Answer

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;
  }