Zilee Posted August 11, 2010 Share Posted August 11, 2010 Is it possible to stop a centered div using % to stop moving at some point during a re-size? Because currently my div is centered but if I re-size too much is goes below the menu while I would want it to stop at the menu. Link to comment Share on other sites More sharing options...
chibineku Posted August 12, 2010 Share Posted August 12, 2010 You can set the min-width attribute to some px, em or pt value to prevent it getting squished too small. Link to comment Share on other sites More sharing options...
trinistorm Posted August 12, 2010 Share Posted August 12, 2010 When you use the % values the div is adjusted as a percentage of the view port's width, so its going to change. The max-width modifiers could be used or just fixed widths Link to comment Share on other sites More sharing options...
niche Posted August 12, 2010 Share Posted August 12, 2010 I've wondered about reasons behind that property. Thanks. Link to comment Share on other sites More sharing options...
trinistorm Posted August 12, 2010 Share Posted August 12, 2010 No problem its all in the documentation at w3.org. Link to comment Share on other sites More sharing options...
dsonesuk Posted August 12, 2010 Share Posted August 12, 2010 Sorry wrong topic. Link to comment Share on other sites More sharing options...
Howdy_McGee Posted August 12, 2010 Share Posted August 12, 2010 Even if you used max-width though - wouldn't you have to use pixels rather than percentages? You can't have "max-width: 50%" can you; since it will readjust? Link to comment Share on other sites More sharing options...
thescientist Posted August 12, 2010 Share Posted August 12, 2010 percentages are relative units. if you had the div in a 1000px tall parent div, than 50% would work (max width would be 500px, half of the parent div). when dealing with relative units of measurements, you have to take context into consideration. I think often times max width is used when creating container div's whose widths are relative units (%) and you want keep the view port from over stretching in cases where the user may have a larger than anticipated resolution. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.