The "right" margin probably depends on the screen size, orientation, text size, and bezel size/shape. There has to be a minimum margin (1mm?) plus something proportional to the text size (1em?), but that is never more than some percentage of the screen width or height (5%?). But elaborate formulas like this cannot be coded with css