Try giving your image a max-width instead of max height.
img
{
width:100%;
max-width:500px; /* this will stop it from expanding when you widen the browser
height:auto; /* height will automatically adjust to width.
}
You didn’t give any specifications on if you image is a square or nested in a square div, but if it’s a div, you can give the div a 100% width and a padding-bottom of 100% or 50% to make it a square. If this is the case please reply and I’ll be happy to help again
Here is a code pen
https://codepen.io/BramWerink/pen/GRpvgaB
Related Posts:
- How to reference a theme image in a stylesheet?
- Making WordPress Gallery (.gallery-item) Responsive?
- Adding HTML within an image title attribute
- Width 100%: Aspect ratio of image
- Add CSS class to every image
- How to Make WordPress Default gallery responsive on mobile?
- Responsive background images added inline
- @wordpress/create-block image url in css
- How can I upload an image for background use using the Theme Editor in WordPress?
- Override img class in gallery
- Multiple amp-image overlays. How to properly do this in wordpress?
- Image not shown in the theme as it’s showing in HTML template [closed]
- How to handle a background-size: cover image in WordPress?
- Background-image not showing? [closed]
- t5-fresh-editor-stylesheets.php breaks image placement in WP Beta 3 editor
- How do I get my main image to stretch the full length of the screen?
- How to upload and style svg logo?
- How would you add sequentially numbered labels to images in posts?
- How to implement CSS-defined images from bootstrap site in wordpress theme
- a: hover issue with image issues [closed]
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- Moving an image to the side [closed]
- Image Captions Have a 10px Extra Margin, And It’s Not CSS? [duplicate]
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- Image modification
- How to remove image size inline style in article and include caption
- Is there a layout to place 2 same sized images in two columns on the WordPress page?
- Landing Page with HTML CSS JS and Images on wordpress
- How to change background image
- Change header image size
- Adding custom html/css/images to Theme
- Is there a way to create referable automatic numbering in image captions?
- Why do images inserted in the post content via the_content() go off the max-width?
- How can we achieve this image css style?
- Remove image border in twentyeleven theme [closed]
- How to display posts with images in fullscreen slider
- Using a full-width hero image that can be changed in the dashboard by a user
- Put image onto header
- Are WP images responsive by default?
- Image thumbnail on single product issue | WooCommerce
- Background image call problem
- all images of past post messed up after changing theme
- Custom styling Insert Media window
- Display ajax preloader for large images within posts
- An image on my site is showing as the wrong image [closed]
- Theme files and imagesnot loading on a mobile device
- Is there a good way to use CMS images with CSS
- change with CSS the color of an svg background image set with “background-image: url()”
- Stop underlining image links
- Font size on image captions on mobile
- Parallax image problem
- Theme using masonry layout script rendering overlaped images in Google Chrome [closed]
- Why is inline CSS added to images automatically? [closed]
- Create decorative image border with CSS? [closed]
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- I am having trouble displaying an image at the top of a widget area [closed]
- Is there a way to add background-image to theme.json?
- How to change image type for specific size?
- Mixed content warnings after changing site adress from HTTP to HTTPS
- add_image_size() zoom-crop
- Slider image issue in wordpress
- Getting custom size image URL
- Retrieving images from a NextGEN gallery
- Getting alt text of featured image
- How to resolve – IE 6 ignores img “width” properties
- WordPress is stripping the Alt tag’s quote marks from images where Alt is not set, but leaving the word ‘alt’ creating problems for ADA compliance
- WordPress reduces the full size image and uses it as the original
- Show taxonomy list with taxonomy images ( SOLVED)
- Is There A Way Of Using the_post_thumbnail() to Pull In A Specific Image From The Media Library
- Output random (custom) image size
- WordPress crops images differently on retina screens?
- How do I create an alternate RSS feed for tags with custom image sizes for MailChimp?
- How to add an image to a custom url?
- Facebook og:image issues after https change [closed]
- How to use Facebox in WordPress theme?
- Mass crop images: Landscape images -> Portrait images
- How to redirect homepage to actual URL?
- Alt Image WordPress [closed]
- Some Images Disappeared from Media Library?
- Get an image from url, resize it, and save on a custom folder (not the media library)
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- Background Image Does Not Display on Page
- Can’t fix corrupted images
- There is an image embedded on my page that I can’t locate in order to delete. Please help me!
- Could creation of various image sizes cause slow form submission response?
- How to add featured image use HTML
- Correct color profile and saving? Thumbnail creation?
- stop wordpress from resizing feature gif images
- Modify media file markup output
- WPML – Change media uploader language
- WordPress Is Saving Original Image Only
- Display images from JS?
- How to make an image bigger with wp_get_image_editor
- Orientation of featured image in post?
- Delete all thumbnails & regenerate them?
- Can I turn an image into a button?
- Why are some SVG-images not visible in my footer?
- How To Get Feature Image from Blog in Same WordPress Multisite Blog on the Parent Blog?
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions