• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

width of a table column

given

<table >
<tr><td width="20%">asddasd</td><td width="80%">dsdadds</td></tr></table>
when I check objectid.width I get "20%" and "80%".

What is this 20% and 80% of and how can I get the actual px of each ?
0
HalCHub
Asked:
HalCHub
1 Solution
 
GaryCommented:
You can't, percentages are proportional based on browser size. You could take a screenshot and then use something like Photoshop to get the actual size.
0
 
xtermieCommented:
0
 
GaryCommented:
Addendum to my comment
That would be the actual size as of that instance, once you resize the browser those values (px) will change again.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
aprestoCommented:
Agreed, and apologies if i duplicate what is in the article posted. But unless you capture the size of the window at the time you cant do this. for example, window width = 1000, then:

1000 * 0.2 = 200 (0.2 being 20%)

But this is complicated because you would have to do this every time the window is resized which would include some ajax calls. On a windows form it wouldbt be a problem, on a web page its a completely different ball game.

Here is some javascript to the get window size, however by the sound of things you would need to manipulate it from the code behind which involves submitting this info to the server in order to do this, you could stick it in a hidden field and do it that way:

http://mauzon.com/how-to-get-real-window-width/

All together, not a recommened operation. What are you trying to achieve?
0
 
Wayne BarronCommented:
You could use it like this.
Give your Table Main, a set width, and then set the percentage between the 2 columns.
If I have misunderstood the question, please disregard.
Carrzkiss
<style type="text/css">
#MainTD{
	width:700px;
}
.tdR{
	width:80%;
}
.tdL{
	width:20%
}
</style>
</head>

<body>
<table id="MainTD">
<tr><td class="tdL">Something here</td><td class="tdR">Something here right here in the bigger area</td></tr>
</table>

Open in new window

0
 
HalCHubAuthor Commented:
so there is no way to query what the actual column width is when it is rendered ....
0
 
GaryCommented:
No the values are dynamic, all you could get is the width at load but that will change with browser size.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now