Markup:
<div class="post">
<div class="thumbnail">
<img class="thumb" src="http://placehold.it/950x450/" />
</div>
</div>
CSS:
.post {
width: 500px;
}
.post img.thumb {
width: 100%; /* fill available space of parent and keep aspect ratio */
}
Fiddle: http://jsfiddle.net/
Related Posts:
- How to decrease picture size
- Can’t remove WordPress post image height/width attributes?
- Responsive Images Warping
- How can I add inline CSS for each image?
- Extending site width according to the image size
- How to target only one element if more elements share the same CSS class
- Why is the image in div not displayed in full-size?
- What is WebKit and how is it related to CSS?
- How can I vertically center a “div” element for all browsers using CSS?
- Is there a color code for transparent in HTML?
- How do I hide the bullets on my list for the sidebar?
- How to override the properties of a CSS class using another CSS class
- CSS display: inline vs inline-block
- Aligning two divs side-by-side
- How to center HTML5 Videos?
- Text border using css (border around text)
- Is there an opposite CSS pseudo-class to :hover?
- U8Qtu
- Using custom fonts using CSS?
- How can I transition height: 0; to height: auto; using CSS?
- Display Images Inline via CSS
- Why CSS3 Animation is not working?
- Using margin / padding to space span tag from the rest of the p tag
- Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?
- How to change version of .css in WordPress?
- Disable SSL / HTTPS for wordpress
- Style something only on the home page
- How do I register/enqueue a custom CSS file?
- How do I remove specific styles from the parent theme css using the child theme css?
- Why isn’t my theme processing SASS?
- What CSS rules are introduced to core blocks through wp-block-styles?
- Trying to load a responsive CSS media query using Custom Taxonmy
- Changing CSS in Twenty Eleven to change font size of body text
- Deregister CSS style link ‘open-sans-css’
- @wordpress/create-block image url in css
- Limit function to specific post category
- How to load different css file depending on language
- I want to change my post titles from h2 to H1
- Change logo on specific page id using css
- Write text below a specific part of a sentence
- Style classic editor buttons
- Remove id attribute from stylesheet link
- Layer post title on top of image WordPress featured thumbnail image
- Twig + wordpress – how to get filemtime for style.css
- Font embedding in wordpress
- Inconsistent `body_class()` function
- How to Add Custom CSS to the Media Thickbox?
- Link theme options page using ACF to styles
- WordPress Twenty Seventeen header image size not responsive for mobile
- WordPress Light/Dark Theme best practices? Is there a way that really works?
- footer disappear on some pages frequently
- How to change H1 color only for pages [closed]
- Background image reversed on pages after home page [closed]
- How to get an unique identifier for a page/post/category/tag etc.?
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- Remove CSS Attribute by Overriding CSS in Child Theme
- CSS gap issue in div element
- WordPress custom CSS file overrided by internal CSS [closed]
- Can you change the color of svg icons to the global color I choose from WordPress
- After moving my site, sub-menus are not showing [closed]
- Theme twentythirteen widget area clearfix
- a: hover issue with image issues [closed]
- Disable CSS for IE 8 and earlier.
- Using categories on navigation bar instead of pages
- Superfish and WordPress: Active Color Problem
- I have a wordpress website which uses a really weird font on Opera. What do I need to do to fix it?
- Elementor – Edit Global Colors Order
- the_post layout
- How To Remove All Other Plugins CSS
- Is there a layout to place 2 same sized images in two columns on the WordPress page?
- Modal dialog under the backdrop
- Hot reload failing to update file changes
- How can I hide this custom slider while Elementor editing window is open?
- Clickable Text To Replace Radio buttons
- How to remove the specific class
- Customizer Appearance Issue
- Change mobile menu color from red to another color
- Change the version of default style.css in wordpress
- style.css not working but customizer additional css does?
- Performance hit of Inline CSS
- Hide duplicate entry title
- How to set different color in a select box due to selection with css
- How to disable all css from the theme for a specific post type page
- Fonts are parsed in one way but rendered in a different way
- How can we achieve this image css style?
- Divi Theme HTML code is different in View Page Source than in the Firefox Inspector
- Add WordPress Core CSS into editor-style.css
- WP Page Builder – Remove table border?
- How can a left and right margin be added to the admin bar without access to “…wp-includes/admin-bar.php”?
- How to implement styling of div in the front end using plugin admin meta box settings?
- Inserting a DIV Block Into a Listing of Excerpts?
- WordPress Custom Superfish CSS Problem [closed]
- Browser stacks different versions of style.css
- Is it possible to make invisible a div only on certain pages using CSS?
- What CSS selectors to know for WordPress? [closed]
- MY CSS FILE IS MISBEHAVING. IS NOT WORKING WELL ON MY WP SITE [closed]
- Image is very blurry
- WordPress site suddenly not showing some DOM elements but mobile is fine
- Editing size of h3 tag in wordpress on a one-off basis
- Content doesn’t fit on large size desktops like 2560×1440