Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8445297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:37:18+00:00 2026-06-10T09:37:18+00:00

I’ve isolated some weird behavior that seems to occur when you have a block

  • 0

I’ve isolated some weird behavior that seems to occur when you have a block which is styled overflow: hidden, and uses a font declared with @font-face (I’ve been using Google Web Fonts). clientHeight doesn’t correspond to the real height of the element — seems to be somewhat shorter. I’ve reproduced in Chrome & in Firefox. Does anyone know what’s going on here?

(Unfortunately it won’t reproduce in JSFiddle, but here’s the code — if you look at this in your browser unmodified you should see about ~80% of the paragraph.) (https://gist.github.com/2702563)

<!DOCTYPE html>
<html>
    <head>
        <link href='http://fonts.googleapis.com/css?family=Tenor+Sans|Esteban' rel='stylesheet' type='text/css'>
        <style>
            #demo{
                width: 30em;
                            /* comment either of the lines below out and it'll work */
                overflow: hidden;
                font-family: 'Esteban';
            }
        </style>
    </head>
    <body>
        <div id="demo">
            <p>I give Pirrip as my father's family name, on the authority of his
            tombstone and my sister,&mdash;Mrs. Joe Gargery, who married the blacksmith.
            As I never saw my father or my mother, and never saw any likeness
            of either of them (for their days were long before the days of
            photographs), my first fancies regarding what they were like were
            unreasonably derived from their tombstones. The shape of the letters on
            my father's, gave me an odd idea that he was a square, stout, dark man,
            with curly black hair. From the character and turn of the inscription,
            &ldquo;Also Georgiana Wife of the Above,&rdquo; I drew a childish conclusion that
            my mother was freckled and sickly. To five little stone lozenges, each
            about a foot and a half long, which were arranged in a neat row beside
            their grave, and were sacred to the memory of five little brothers of
            mine,&mdash;who gave up trying to get a living, exceedingly early in
            that universal struggle,&mdash;I am indebted for a belief I religiously
            entertained that they had all been born on their backs with their hands
            in their trousers-pockets, and had never taken them out in this state of
            existence.</p>
        </div>
        <script>
            document.getElementById('demo').style.height = document.getElementById('demo').clientHeight + 'px';
        </script>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:37:19+00:00Added an answer on June 10, 2026 at 9:37 am

    It looks like the script is interpreted before the font is applied to the parragraph. If you deactivate the webfont, the height of the box is exactly as expected: The whole paragraph is readable.
    If you debug the code and set a breakpoint at the script and continue execution after the page finished loading, there is no unexpected height.

    You can fix the problem by executing the script in the window.onload-event so the clientHeight is read after the webfont is applied:

    <!DOCTYPE html>
    <html>
       <head>
          <link href='http://fonts.googleapis.com/css?family=Tenor+Sans|Esteban' rel='stylesheet' type='text/css'>
          <style>
             #demo{
                width: 30em;
                overflow: hidden;
                font-family: 'Esteban';
             }
          </style>
       </head>
       <body>
          <div id="demo">
             <p>I give Pirrip as my father's family name, on the authority of his
               tombstone and my sister,&mdash;Mrs. Joe Gargery, who married the blacksmith.
               As I never saw my father or my mother, and never saw any likeness
               of either of them (for their days were long before the days of
               photographs), my first fancies regarding what they were like were
               unreasonably derived from their tombstones. The shape of the letters on
               my father's, gave me an odd idea that he was a square, stout, dark man,
               with curly black hair. From the character and turn of the inscription,
               &ldquo;Also Georgiana Wife of the Above,&rdquo; I drew a childish
               conclusion that my mother was freckled and sickly. To five little stone
               lozenges, each about a foot and a half long, which were arranged in a neat
               row beside their grave, and were sacred to the memory of five little
               brothers of mine,&mdash;who gave up trying to get a living, exceedingly
               early in that universal struggle,&mdash;I am indebted for a belief I
               religiously entertained that they had all been born on their backs with
               their hands in their trousers-pockets, and had n ever taken them out in
               this state of existence.</p>
            </div>
            <script>
             window.onload = function(){document.getElementById('demo').style.height = document.getElementById('demo').clientHeight + 'px';}
            </script>
         </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.