SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: My Poll Bar

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    USA
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My Poll Bar

    I made a poll. I have everything working, except 1 thing. It's the size of the bar. I got the percent of each poll answer, but when I put width="% of result" it is real small. I need to use pixels. Does anyone know how to do this?
    Thanks
    -Chad
    Chad Crouch
    http://chadmc.com

  2. #2
    SitePoint Addict -TheDarkEye-'s Avatar
    Join Date
    Feb 2001
    Location
    canada
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    easy

    what is the maximum length in pixels that the bar can be?

    that will be 100%.

    to find length in pixels for varrying percents all you need to do is take the percent value in decimal form (ie: 65% = 0.65) and multiply it by the maximum length of the bar.

    example: say you wanted a 65% long bar and the maximum length of the bar is 112pixels.

    0.65 * 112 = 72.8 which is approximatly 73 pixels (youll have to round up or down as you cant use decimal values for dimentions in html).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •