locked
indent inside div RRS feed

  • Question

  • Hey everyone,

    I'm about to build a web application to show documents in the browser.
    For that I get all the necessary data in JSON format, which was created by another application.

    But there is one problem:

    To display text, I use a div and inside the div I position all the words with the same formatting inside one span tag.

    The width of the div is calculated by summing up the width of every character in one line, but in browsers there is a certain indent (see the screenshot), thus the calculated div is too small for all the words and an unwanted line break occurs.

    Screenshot

    Is there any way to remove the indent or to calculate the size of this indent to get the right width for the div?

    Thanks in advance for your help!
    Steve
    Tuesday, July 10, 2012 6:14 AM

Answers

  • reset.css

    <p> is the semantic element for containing text.

    font-size defaults are user and browser specific. you cannont reliably calculate the absolute ex value. Only misie browsers expose deviceXDPI and logicalXDPI.


    Rob^_^

    Wednesday, July 11, 2012 1:08 AM