Jump to content

Stop a div from moving.


Zilee

Recommended Posts

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...