html - Auto adjust the height of container based on content -
every time put huge content details, such text goes out of container.how can make container height auto adjustable based on content;.
#container { background-color: #262626; width: 1000px; min-height: 200px; margin: 0 auto; margin-top: 40px; padding-top: 20px; -webkit-border-top-left-radius: 30px; -webkit-border-top-right-radius: 30px; -moz-border-radius-topleft: 30px; -moz-border-radius-topright: 30px; border-top-left-radius: 30px; border-top-right-radius: 30px; } #main { position: relative; top: 116px; width: 980px; height: 700px; float: left; background-color: #262626; padding: 10px 10px; margin-bottom: 40px; background: -webkit-linear-gradient(#262626,#101010); /* safari */ background: -o-linear-gradient(#262626,#101010); /* opera 11.1 12.0 */ background: -moz-linear-gradient(#262626,#101010); /* firefox 3.6 15 */ background: linear-gradient(#262626,#101010); /* standard syntax */ -webkit-box-shadow: 0 10px 6px -6px black; -moz-box-shadow: 0 10px 6px -6px black; box-shadow: 0 10px 6px -6px black; -webkit-border-bottom-right-radius: 30px; -webkit-border-bottom-left-radius: 30px; -moz-border-radius-bottomright: 30px; -moz-border-radius-bottomleft: 30px; border-bottom-right-radius: 30px; border-bottom-left-radius: 30px; }
in #main
css you've set height 700px
.
change
height:auto;
and work fine. since default value anyway, remove height declaration completely, instead.
live demo
or, if wanted have minimum height of 700px
, say;
min-height:700px;
of course, there many other 'versions' of height can set. including (but not limited to):
- min-height
the min-height css property used set minimum height of given element. prevents used value of height property becoming smaller value specified min-height.
- max-height
the max-height css property used set maximum height of given element. prevents used value of height property becoming larger value specified max-height.
- line height
on block level elements, line-height css property specifies minimal height of line boxes within element.
all of can used set elements in way want
here's reference link you.
mdn summary of height property
Comments
Post a Comment