width of a table column

Posted on 2012-09-17
Last Modified: 2012-10-08

<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 ?
Question by:HalCHub
    LVL 58

    Expert Comment

    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.
    LVL 16

    Accepted Solution

    LVL 58

    Expert Comment

    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.
    LVL 23

    Expert Comment

    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:

    All together, not a recommened operation. What are you trying to achieve?
    LVL 30

    Expert Comment

    by:Wayne Barron
    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.
    <style type="text/css">
    <table id="MainTD">
    <tr><td class="tdL">Something here</td><td class="tdR">Something here right here in the bigger area</td></tr>

    Open in new window

    LVL 1

    Author Comment

    so there is no way to query what the actual column width is when it is rendered ....
    LVL 58

    Expert Comment

    No the values are dynamic, all you could get is the width at load but that will change with browser size.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    ODBC connection string for ODBC 6.01 24 58
    Migrated SQL connection issues 2012 6 33
    CSS Question.. 3 63
    Update field in order 21 95
    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now