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 9176421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:06:25+00:00 2026-06-17T17:06:25+00:00

My image container is image-wrap class , .image-wrap img width & height is set

  • 0

My image container is image-wrap class , .image-wrap img width & height is set to 100% which fill the container.

Css:

    .image-wrap{
    width:600px;
    height:400px;
    position:relative;
    overflow:hidden;
    }
    .image-wrap img{
    position:relative;
    width:100%;
    height:100%;
    }

Now I want to set 5 px padding inside image-warp, this also need to change .image-wrap img width and height to some another % value. How to calculate and set this as jquery var, so I can add it to image-wrap img class using jquery. My padding of 5 px remains same even for any other width -height value pair for image-wrap (may be for responsive design).Help me evaluating mathematical equation to set width height % as jquery var.

  • 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-17T17:06:26+00:00Added an answer on June 17, 2026 at 5:06 pm
    jQuery(".image-wrap").each(function() {
    
        myWidth = jQuery(this).width();
        myHeight = jQuery(this).height();
        myWidth = myWidth - 10;
        myHeight = myHeight - 10;
        myWidth = myWidth.toString().concat("px");
        myHeight = myHeight.toString().concat("px");
    
        jQuery(this).find("img").css({
    
            height: myHeight,
            width: myWidth
        });
    });
    

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an image <div class='container'> <img src='../images.jpg' alt='images' /> </div> I want to
I have a seemingly simple html construct: <div class=featured-image img-wrapper full-width> <a href=http://localhost/wordpress/?p=26> <img
i'm trying to insert an image in a div container using css and html,
In a percentage-width container, a H2 is floated left and an image is floated
I have multiple <div> tag with same width but different height in a container.
I have HTML elements like this: <li class=store-display-item> <div class=store-display-item> <img class=store-display-image src=/Images/ToughBook.jpg> <p>QuickTrav
I have a table cell in which i have to set a background image,
I have an image container with a caption and when I hover over it
How can I center align (horizontally) an image inside its container div? Here's the
I have a container that contains an image that I need to drag from

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.