I need to center a div on the page with the following characteristics:
- the width page is 80%
- width and height as a percentage (eg width: 100%; height: 60%)
- set a minimum and maximum width and height (eg min-width:980px; min-height:588px and max-width:1170px; max-height:702px)
- if I resize the page the div is resized proportionally to the page both vertically and horizontally (if I resize the page vertically only you have to resize the window horizontally also)
can you help? Thank you.
----HTML
<div id="content">
<div id="box">
text
</div>
</div>
----CSS
<style type="text/css">
#content {
width:80%;
background:#000;
margin:0 auto;
}
#box{
width:100%;
height:60%;
background:red;
min-width:980px;
min-height:588px;
max-width:1170px;
max-height:702px;
}
</style>