473,386 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can't find element's real width.

rohypnol
I have the following html structure and style:

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2.   #master {
  3.     width: 200px;
  4.     border: 1px solid black;
  5.     white-space: nowrap;
  6.   }
  7.   #container {
  8.     border: 1px solid red;
  9.   }
  10.   #list li {
  11.     display: inline;
  12.     border: 1px solid blue;
  13.   }
  14. </style>
  15.  
  16. <div id="master">
  17. <div id="container">
  18.   <ul id="list">
  19.     <li id="element1">content1</li>
  20.     <li id="element2">content2</li>
  21.     <li id="element3">content3</li>
  22.     <li id="element4">content4</li>
  23.     <li id="element5">content5</li>
  24.     <li id="element6">content6</li>
  25.   </ul>
  26. </div>
  27. </div>
Is there any way to get the real scrolling width of the #container or #list elements? On Firefox 3.0.x, I get 200px for scrollWidth, clientWidth and offsetWidth (and the getWidth() function in Prototypejs), but it's clearly visible that the real width on my screen is about 600px.



Thanks,
Tom
Jun 19 '09 #1
1 2358
drhowarddrfine
7,435 Expert 4TB
I don't recall exactly what those do but 200px should be correct since it's contained in #master. The fact that they overflow the div, being inline, doesn't matter, I guess, since it is the div that would get the scroll and not the list itself.
Jun 19 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: delerious | last post by:
I need to determine an element's width and height in pixels (not including padding, border, and margin) in Javascript. The element will not have width or height styles specified. In Mozilla, I...
2
by: Branko Collin | last post by:
Hello, The following is perhaps not directly a CSS problem, but it does seem to involve Internet Explorer's stylesheet handling. I tried Svend Tofte's solution for using expressions in...
12
by: deko | last post by:
Is there any way to work around the blank space created by hidden divs? I'm trying to use a relatively postioned divs with show/hide behaviors to annotate an image. The divs show/hide...
2
by: Alejandro Penate-Diaz | last post by:
Hi. Is there any way of getting an element real size from javascript, when this element was previously assigned a width and height of 100%? Thanks, Alex.
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
5
by: felipevaldez | last post by:
how can I put an element below another element, that's not absolutely positioned? so I have a n element, called X, and next to that, an element Y X Y XXXXXX
1
by: redgrL86 | last post by:
Hi, I am trying to create a table to display the values in the XML below. THe XSL provided works on the XML when there is only one <Step> but not three. Of the three steps in the XML below, two have...
2
by: everly | last post by:
Hi, I'm helping my friends band and making their MySpace. I messed something up and I can't figure out what it is. Everything is all out of whack on the bottom half of the page. The comments...
7
by: jeddiki | last post by:
Hi, I am using a function called htmlwrap() which states that it does NOT add a "<br>" to the 70 character line so that it forces a line wrap. ( the script safely wraps long words without...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.