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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:40:38+00:00 2026-05-28T15:40:38+00:00

How do you calculate the ‘used/determined’ height of an image when using width=100% .

  • 0

How do you calculate the ‘used/determined’ height of an image when using width="100%". I need this to determine whether or not to use the width="100%" or set a height with a max of n px. This is because of images getting to big for their box (div).

I would like to calculate in advance and not to resize the images after they’re displayed in the browser. (The scenario is in a product-layout).

  • 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-05-28T15:40:39+00:00Added an answer on May 28, 2026 at 3:40 pm

    If the height is the limit, why not use height as the property to adjust the image size as well?

    If this support is sufficient, you could use max-height and height:

    img {
      height:100%;
      max-height:115px;  
    }
    

    example: http://jsfiddle.net/JdQK6/

    You would set the max-height to the maximum height you’d want the image to be.

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

Sidebar

Related Questions

how can i calculate width and height of a string when i draw that
To calculate a top position for an element of variable height, I was thinking
How can I calculate the value of PI using C#? I was thinking it
I need to calculate Math.exp() from java very frequently, is it possible to get
I need to calculate averages, standard deviations, medians etc for a bunch of numerical
to calculate some longitude and latitude values I need more decimal places like mysql
all I want to calculate the height of the page ,and in my test.less
Edit: See Calculate how many minutes used in a given hour for how I
I calculate a number of sums and I need to find the minimum of
Im trying to calculate the bitrate from a video, but Im not sure if

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.