Disabling a previously specified max-width

I just did something stupid with my CSS but it had me scratching my head for a while.

If you have a max-width set and need to disable it in a cascaded style, you need to set it to none rather than auto i.e.:

img {
    max-width:100%;
}

#some-other-selector img {
    max-width:none;
}

This sounds obvious (and it is really), but because you usually use width:auto to override a previously specified width, I found myself inadvertantly doing the same with max-width and it took a while to realise what I’d done.

This entry was posted in Tips and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

8 Comments


  1. Fatal error: Uncaught Error: Call to undefined function ereg() in /var/www/html/wp-content/themes/thematic/library/extensions/comments-extensions.php:262 Stack trace: #0 /var/www/html/wp-content/themes/thematic/library/extensions/discussion.php(30): thematic_commenter_link() #1 /var/www/html/wp-includes/class-walker-comment.php(180): thematic_comments(Object(WP_Comment), Array, 1) #2 /var/www/html/wp-includes/class-wp-walker.php(146): Walker_Comment->start_el('', Object(WP_Comment), 1, Array) #3 /var/www/html/wp-includes/class-walker-comment.php(140): Walker->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #4 /var/www/html/wp-includes/class-wp-walker.php(371): Walker_Comment->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #5 /var/www/html/wp-includes/comment-template.php(2040): Walker->paged_walk(Array, '5', 0, 0, Array) #6 /var/www/html/wp-content/themes/thematic/comments.php(80): wp_list_comments('type=comment&ca...') #7 /var/www/html/wp-includes/comment-template.php(1430): require('/var/www in /var/www/html/wp-content/themes/thematic/library/extensions/comments-extensions.php on line 262