{"id":3235,"date":"2009-08-06T15:00:22","date_gmt":"2009-08-06T22:00:22","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=3235"},"modified":"2009-08-11T04:59:03","modified_gmt":"2009-08-11T11:59:03","slug":"cross-browser-min-height","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/css\/cross-browser-min-height\/","title":{"rendered":"Cross-Browser Min Height"},"content":{"rendered":"
div { \r\n   min-height: 500px; \r\n   height:auto !important; \r\n   height: 500px; \r\n}<\/code><\/pre>\n

This works because (thankfully?) IE treats “height” how “min-height” is supposed to be treated.<\/p>\n

Source: Dustin Diaz<\/a><\/p>\n

Alternate Using Expressions (IE Only)<\/h4>\n
div {\r\n   height: expression( this.scrollHeight < 501 ? \"500px\" : \"auto\" );\r\n}<\/code><\/pre>\n

Sets the minimum height in IE to be 500px. Make sure that this.scrollHeight < 501 is 1 px greater than the minimum height that you want or you will get some strange results.\n<\/p>\n","protected":false},"excerpt":{"rendered":"

div { min-height: 500px; height:auto !important; height: 500px; } This works because (thankfully?) IE treats “height” how “min-height” is supposed to be treated. Source: Dustin Diaz Alternate Using Expressions (IE Only) div { height: expression( this.scrollHeight < 501 ? “500px” : “auto” ); } Sets the minimum height in IE to be 500px. Make sure […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3222,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":332875,"url":"https:\/\/css-tricks.com\/almanac\/properties\/a\/aspect-ratio\/","url_meta":{"origin":3235,"position":0},"title":"aspect-ratio","date":"January 20, 2021","format":false,"excerpt":"The CSS property aspect-ratio lets you create boxes that maintain proportional dimensions where the height and width of a box are calculated automatically as a ratio. It's a little math-y, but the idea is that you can divide one value by another on this property and the calculated value ensures\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/05\/Screen-Shot-2020-05-29-at-6.23.02-AM.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3856,"url":"https:\/\/css-tricks.com\/snippets\/css\/absolute-center-vertical-horizontal-an-image\/","url_meta":{"origin":3235,"position":1},"title":"Absolute Center (Vertical & Horizontal) an Image","date":"September 4, 2009","format":false,"excerpt":"CSS background-image Technique: html { width:100%; height:100%; background:url(logo.png) center center no-repeat; } CSS + Inline Image Technique: img { position: absolute; top: 50%; left: 50%; width: 500px; height: 500px; margin-top: -250px; \/* Half the height *\/ margin-left: -250px; \/* Half the width *\/ } Table technique: html, body, #wrapper {\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":324840,"url":"https:\/\/css-tricks.com\/almanac\/properties\/m\/max-inline-size\/","url_meta":{"origin":3235,"position":2},"title":"max-inline-size","date":"November 3, 2020","format":false,"excerpt":"max-inline-size is a logical property in CSS that defines the maximum width of an element when the writing-mode is horizontal, or the maximum height of the element when the writing-mode is vertical. .element { \u00a0 max-inline-size: 500px; \u00a0 writing-mode: vertical-lr; } CodePen Embed Fallback As you might have guessed by\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":376323,"url":"https:\/\/css-tricks.com\/almanac\/properties\/b\/border-image-width\/","url_meta":{"origin":3235,"position":3},"title":"border-image-width","date":"January 12, 2023","format":false,"excerpt":"The CSS border-image-width property is used to determine the width of the border\u2019s image file, as provided by the CSS border-image-source property. .container { border-style: ridge; border-width: 3rem; border-image-source: url('path\/to\/image.jpg'); border-image-slice: 70; border-image-width: 40%; border-image-repeat: repeat; } CodePen Embed Fallback The border-image-width property is defined in the CSS Backgrounds and\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/12\/css-tricks-logo-gradient-outline.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":14071,"url":"https:\/\/css-tricks.com\/almanac\/properties\/m\/min-height\/","url_meta":{"origin":3235,"position":4},"title":"min-height","date":"September 5, 2011","format":false,"excerpt":"The min-height property in CSS is used to set the minimum height of a specified element. The min-height property always overrides both height and max-height. Authors may use any of the length values as long as they are a positive value. .wrapper { height: 100%; \/* full height of the\u2026","rel":"","context":"With 7 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14073,"url":"https:\/\/css-tricks.com\/almanac\/properties\/m\/max-height\/","url_meta":{"origin":3235,"position":5},"title":"max-height","date":"September 5, 2011","format":false,"excerpt":"The max-height property in CSS is used to set the maximum height of a specified element. Authors may use any of the length values as long as they are a positive value. max-height overrides height, but min-height always overrides max-height. .wrapper { height: 100%; \/* full height of the content\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3235"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=3235"}],"version-history":[{"count":4,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3235\/revisions"}],"predecessor-version":[{"id":3353,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3235\/revisions\/3353"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3222"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=3235"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=3235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}