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 8463125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:22:48+00:00 2026-06-10T14:22:48+00:00

I have div element with specified width and height expressed in percents in CSS.

  • 0

I have “div” element with specified width and height expressed in percents in CSS.
I would like to get by JS script its width and height expressed in pixels. It’s even possible?

  • 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-10T14:22:50+00:00Added an answer on June 10, 2026 at 2:22 pm

    You can use

    el.clientHeight;
    el.clientWidth;
    

    (elis a reference to the element)

    Demo

    Note those properties were first introduced in the MS IE DHTML object model. More recently they were standardized in CSSOM View Module, W3C Working Draft 22 February 2008.

    Those properties were widely supported. However, it’s possible than an old non-MS compliant browser doesn’t support them. In those cases, you can use getComputedStyle:

    function findSize(el, size) {
        /* size must be 'width' or ' height' */
        return window.getComputedStyle
            ? getComputedStyle(el,null).getPropertyValue(size)
            : el['client'+size.substr(0,1).toUpperCase() + size.substr(1)] + 'px';
    }
    findSize(el, 'width');
    findSize(el, 'height');
    

    Demo

    Browser support of getComputedStyle and clientHeight/clientWidth way is at least:

                     | IE  | Firefox | Chrome | Safari | Opera
    -----------------|-----------------------------------------
    getComputedStyle | 9   | <=3     | 1      | <=4    | <=10
    client           | <=5 | <=3     | 1      | <=4    | <=10
    

    (<=n means that it’s supported at least from version n, but I couldn’t test previous versions)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div element with fixed height and width and overflow:hidden, and I
I have a div element in an HTML document. I would like to extract
I have a bunch of elements like the following: <div class=droppableP id=s-NSW style=width:78px; height:63px;
I have a dom element like div , span (with display:inline-block ), whose width
I have a containing div that is constrained in its height and width. It
I have this piece of HTML: <div class=embed> <iframe width=300 height=200 frameborder=0 allowfullscreen= src=http://www.youtube.com/embed/123456></iframe>
I have a few images with css -> $(.toolTip). <img width=150 height=200 src=<?php echo
I have a problem to load specific div element and show on my page
I have DIV element which only has a few lines in and a background
I have a div element which acts as a global contianer for my webpage,

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.