msphelix Posted July 20, 2012 Share Posted July 20, 2012 As far as I can tell anything I can do with max-height, max-width, min-height, and min-width I can do with height and width - what are they suppose to do that only they can do? Link to comment Share on other sites More sharing options...
ShadowMage Posted July 20, 2012 Share Posted July 20, 2012 They specify the corresponding min/max values. For example, min-width: 200px will not allow the element to go smaller than 200px wide. The effects of these properties aren't easily noticeable (especially the min- properties) until you resize the browser window. The max- values prevent elements from getting too big. So if you set a max-height and you put a lot of content in an element, the element will only be as tall as its max-height will allow. Content that doesn't fit will be displayed (or hidden) depending on the overflow property. Usually, that means the element will become scrollable. Link to comment Share on other sites More sharing options...
boen_robot Posted July 20, 2012 Share Posted July 20, 2012 The effects of min/max-width/height become most apparent when width/height use relative units, while min/max-width/height use absolute ones. With those combined, you'll be saying, for example "Have this element 100% (width) of the window width, but if this width is less then 100px (min-width), stretch it to be exactly 100px, and if it's larger than 800px (max-width), shrink it to 800px". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now