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

  • Home
  • SEARCH
  • 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 977837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:58:00+00:00 2026-05-16T03:58:00+00:00

I was wondering if in the width and height <img> attributes, I could specify

  • 0

I was wondering if in the width and height <img> attributes, I could specify width and height as percentages?

Well, I guess that is obvious, because when I try so, it resizes, but it appears to skew the quality of my image.

Here is an example of my markup with fixed attributes:

<img src="#" width="346" height="413">

Now, while trying to scale this down, say by half, via percentages:

<img src="#" width="50%" height="50%">

I get something completely different than:

<img src="#" width="173" height="206.5">

I think I’m just fundamentally mistaking my percentage markup or something because there is a noticeable difference between my second and third example visually.

  • 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-16T03:58:01+00:00Added an answer on May 16, 2026 at 3:58 am

    Note: it is invalid to provide percentages directly as <img> width or height attribute unless you’re using HTML 4.01 (see current spec, obsolete spec and this answer for more details). That being said, browsers will often tolerate such behaviour to support backwards-compatibility.

    Those percentage widths in your 2nd example are actually applying to the container your <img> is in, and not the image’s actual size. Say you have the following markup:

    <div style="width: 1000px; height: 600px;">
        <img src="#" width="50%" height="50%">
    </div>
    

    Your resulting image will be 500px wide and 300px tall.

    jQuery Resize

    If you’re trying to reduce an image to 50% of its width, you can do it with a snippet of jQuery:

    $( "img" ).each( function() {
        var $img = $( this );
        $img.width( $img.width() * .5 );
    });
    

    Just make sure you take off any height/width = 50% attributes first.

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

Sidebar

Related Questions

was wondering if there are anyone else here that has signed up with the
Wondering how to open many new windows with Javascript. I have found plenty of
Wondering if anyone can help me with this annoying but trivial (in terms of
I'm wondering how do you deal with displaying release revision number when pushing live
i was wondering how you deal with permalinks on international sites. By permalink i
With very large amounts of ram these days I was wondering, it is possible
Just wondering what the difference between MFC control messages prefixed with the following is:
I'm wondering what the best practice is for handling the problem with having to
I was wondering if there is a better way to cope with MS-Access' inability
I'm wondering what strategies people use for reduced sign on with legacy applications and

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.