1. A method for rendering a document on a web browser, the method comprising: receiving a portion of text within the document to be rendered on a web browser; determining a maximum height of the portion of text; inserting into the portion of text a spacer element with a height greater than the maximum height of the portion of text; adjusting, by an offset, a vertical position of the portion of text and the spacer element, wherein a baseline of the portion of text is determined from the height of the spacer element and the offset; and rendering the portion of text on the web browser based at least in part on the baseline.