www.webdeveloper.com
Results 1 to 7 of 7

Thread: max min width/height

  1. #1
    Join Date
    Apr 2009
    Posts
    19

    Question max min width/height

    I'm having some trouble understand max min width/height and whether or not I should be using it. If I've already set the width/height of an element then why do I need to specify it's max or min? I've done some searching on google but I'm still kinda scratching my head on this.. If one of you CSS guru's out there could help me out I'd appreciate it.

  2. #2
    Join Date
    Mar 2008
    Location
    Gulf Breeze, Florida
    Posts
    171
    You do not, by any means, have to use max/min height/width. Only use it if it applies to your design or is necessary in order to maintain page structure. I don't think that it will work in IE6-7 but there are hacks, of course.

    Here is an example of when you might use min-height:
    Pretend you had a sidebar on your website that contains a list of events. Lets say that based off of your design the sidebar should be 500px high. So if you give the sidebar a set height of 500px (height: 500px) then it will always be 500px no matter how much content is in it. Lets pretend you start adding tons of events and before you know it there is no room in the 500px high sidebar, so you decide to make the sidebar adjust its height depending on the amount of content. So if you want the sidebar to adjust then you can no longer give the sidebar a set height of 500px (height: 500px). So lets say you take away the set height and all of a sudden have no events in the sidebar, that sidebar would be super small and you would want to use min-height to make sure it retains the 500px height.

    So basically you would use it to control the height/width of an object when giving it a set height/width won't work.
    Last edited by Greyfish; 04-21-2009 at 05:13 PM.

  3. #3
    Join Date
    Apr 2009
    Posts
    19
    I would still like to understand how to use them in case I need to in the future.

  4. #4
    Join Date
    Apr 2009
    Posts
    19
    So it will always be atleast 500px high but will expand to accommodate more content if necessary ?

  5. #5
    Join Date
    Mar 2008
    Location
    Gulf Breeze, Florida
    Posts
    171
    Thats the idea :-)

  6. #6
    Join Date
    Apr 2009
    Posts
    19
    thanks for the info, I appreciate it.

  7. #7
    Join Date
    Mar 2008
    Location
    Gulf Breeze, Florida
    Posts
    171
    Welcome.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles