-
March 7th, 2009, 05:50 AM
#1
Getting the CSS Height of a Div
Hi
I am facing a problem of getting the CSS height and width values of a DIV element for nearly two days now. I have tried all kinds of methods but I couldn't get it work.
I have a DIV which is defined by a CSS class in an external CSS file. The dimensions are 300x300. The thing is, I need to get the values inside the code.
How do I do that? Thanks!
-
March 7th, 2009, 09:50 AM
#2
Re: Getting the CSS Height of a Div
Use the offsetHeight property.
You really should try a Google search next time. It would have taken you about 15 seconds to find the answer.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
March 7th, 2009, 12:52 PM
#3
Re: Getting the CSS Height of a Div
Well, just for your information, I've been working on this problem for two days before I posted it here. That's first.
Second, the offsetHeight property calculates the height of the element after the rendering, i.e. adding the spacing values (padding, borders etc.). So this is not good for me.
But apparently all I had to do was change something in my code. I used getComputedStyle. Google that up.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|