Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8218703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:53:37+00:00 2026-06-07T12:53:37+00:00

the code is : <div class=bar> <div class=percentage style=width:16%; height: 59px;>This is 66% wide

  • 0

the code is :

<div class="bar">
    <div class="percentage" style="width:16%; height: 59px;">This is 66% wide div</div>
</div>

As you can see the width is 16 here….i need a way that it could be changed based on a variable like. I have a php query which returns a certain vale. And the width must be that vale. how can i do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:53:39+00:00Added an answer on June 7, 2026 at 12:53 pm

    You can do it with Javascript. For example with JQuery:

    $('.percentage').css({'width': x%, 'height': xpx});
    

    or you can do it with PHP:

    <div class="percentage" style="width: <?php echo $width; ?>%; height: <?php echo $height; ?>px; ">This is 66% wide div</div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is some code: var class = function(elem,div){ this.elem= elem; this.div = div; this.init
I have the following html code: <div class=outer ui-draggable style=position: relative;> <div class=inner>Foo bar</div>
Here is the problematic part of my code: $('#chat-bar').prepend('<li id=chat-button-with-'+userid+'><a href=#>'+username+'</a></li>'); $('#chat').prepend('<div class=chat-box id=chat-box-with-'+userid+'></div>');
This code attempts to dynamically switch the class of the StateContainer div from StateOne
Here is a simplified snippet of my code: <li id=work-5 class=work-5 class-B> <div>some other
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
The following code does not return anything: $('.foo', $('<div class=foo>foo</div><div class=bar>bar</div>').get(0)).html() Is there any
I have the following HTML code: <div id=filter-bar> <ul> <li><a href=#image class=current><?php _e('Image','sofa'); ?></a></li>
I'm trying to write a code that adds a class to a div for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.