views:

396

answers:

8

Bit of a bizarre question, but does anyone know the actual limit to the length of a webpage, and why it is the limit?

As an experiment, I'm using HTML and CSS to make a site that represents a journey to a scale of 1:1. I have a ul list of markers along the way that I have separated with large margins in the css. However, the longest margin I can get to work so far is

top-margin:100000cm;

Since there are 43 list items, that equates to 4,300,000cm, or 43Km. Does anyone know why it's hitting a limit around this mark, or how I might go about getting it longer? I'm using Safari for testing currently.

+4  A: 

just a guess but 2147483647; max int value

Lavinski
do you think that means the page can only be 2137383647px long, or that measurements in CSS can only be that amount?
Chris Armstrong
Yeah, 2147483647 is just a number. What units are you talking about?
Jimmy Cuadra
I'm using cm in the stylesheet currently
Chris Armstrong
Everything has to be converted to pixels for display, so that's what I'd expect the limit to be on.
Dave Sherohman
32-bit signed integers range from -2147483646 - 2147483647. That's what the comment refers to and could be the artificial limit you're experiencing.
scotts
+4  A: 

There is no limit, as per any HTML/XHTML specification, so this is just the practical limit of the browser that you're hitting. How long a webpage can be is the same as asking how long a book can be.

scotts
+2  A: 

This will depend on the browser. There shouldn't be any clear limit on the length of the HTML file. The pure "length", as in pixels, shouldn't have any clearly defined limit either. Only, the more elements there are in the page, the more the browser has to do, and the sooner it may run out of memory. Memory is about the only limit there is.

deceze
So you memory is my main limit? By that do you mean RAM? I am finding that Safari is able to handle almost double the length that Firefox can
Chris Armstrong
@Chris Yes, RAM, or more generally: computer resources. And as I said, it depends on the browser. Different browsers handle computer resources differently.
deceze
@Chris: If it's a hard limit based on the size of a variable, that "almost double" sounds likely to be an artifact of Safari storing vertical position with an unsigned int and Firefox using a signed int.
Dave Sherohman
+1  A: 

Besides a possible maximum int value, you need to consider the load time for the page. If your web page takes longer than a few seconds to show any interesting content, than you will lose people browsing your content. That's a more meaningful metric than a 1:1 scale metric.

C.D. Reimer
Good point, a little off topic but deserving of my upvote all the same.
Ricket
yes this is off topic because question just try to learn what is the max size it doesn't mind performance issues.
erasmus
+3  A: 

It appears to simply be a maximum value that margin-top property can be set to. I've tried values up to 400,000cm with 100 elements and the page loads them all fine. I even tried incrementing that up to 1000 elements to see if the number was affected by load time, but nothing. It does appear to be an exact number somewhere between 400,000 and 500,000 that it cuts off at and shortens down past that value.

Code I used (which worked, showed in full):

<?php

print "<ul>";
for ($i = 1; $i <= 1000; $i++) print "<li style=\"margin-top: 400000cm;\">{$i}</li>";
print "</ul>";
die();

?>
animuson
right so it's not so much the length of the page thats causing the issue, rather its the length of the margins?
Chris Armstrong
I've limited it down to a value somewhere between 472,500 and 475,000, at least for my browser and OS (if they differ that way). I can't think of any common value or number that are between those two values that the it could be.
animuson
out of interest, what browser/os are you using?
Chris Armstrong
I was using Firefox on Windows 7. I just tested it in IE and Chrome. IE has an obscured scrollbar when the value gets too large and cuts off at 944, though I'm not sure if it's dying there or if it's because of the obscured scrollbar. In chrome, I cannot tell where it leaves off because it has a bunch of extra white-space at the end where it appears it started processing an element and cut it off. Maybe different browsers have different cutoff settings. Firefox appears to be a number, IE a certain size, and Chrome a certain height.
animuson
So it is a browser thing then. Thanks!
Chris Armstrong
+2  A: 

There is no limitation. Even in terms of size of integer, you can create divs in other divs and have all of them biggest value of margin value so your page will not be limited.

erasmus
Ok, but then what IS that biggest margin value?
Chris Armstrong
it's not important. whatever it is, at the end, your web page will not have a limited size because you can create another div in your old div with that margin value.
erasmus
i guess there could be a limitation to the number of divs in a div, eh:)? we won't get there for a while anyway
Halo
+3  A: 

18.939 kilometers, to be exact: http://worlds-highest-website.com/

I.devries
Hmm do you know anything about the guys who made this? They make an interesting claim that "Gecko-based browsers like Firefox show an interesting behavior when you want to make the site any higher (than precisely 18.939583 kilometers, that is), namely by “shrinking” or “collapsing” its main container", which I'd like to find out more about
Chris Armstrong
Came across a comment in their source code that says "Actually, the highest “div” element of the world"... could be that 18.939 is the limit for a single element
Chris Armstrong
I'm assuming it's 18,939,583 i.e. measured in cm. km or m are not valid web page units.
DisgruntledGoat
+2  A: 
  1. It's a browser / memory / os architecture issue.
  2. Measuring it in anything but pixels won't be very useful unless you are referring to the size of a printed webpage on a specific paper size, orientation and scale. Screens have different sizes and DPI's.
Fini