Take a closer look at the code of those modern websites and you'll find an explicit width declaration. Depending on how the site was constructed, it is either hard-coded into the html and css-- one size fits all-- or built dynamically based on a reading of your own window width (or, worse, total screen width: if you've got a 27" monitor I can jolly well force you to use the whole thing for my page).
Most
but not all current browsers will support this format:
div.maintext {margin-left: auto; margin-right: auto; width: 24em;}
(width based on your personal needs) but at least one browser will ignore the "auto" and left-align the whole thing.
For anything beyond centering all text everywhere-- which is trivial but not what you want-- there has to be an explicit width declaration of some kind. That is, you can't simply say "make this part as wide as it needs to be and no wider". There has to be something in ems or pixels. (Not both in the same declaration, or the validator will yap-- for good reason.)
The minimalist version is
div.maintext {margin-left: 10%; margin-right: 10%;}
but this is really only sufficient for text-intensive pages.