It's continuation of this question. Can we decentralize div box from the center? But keep zoom on the box.
Two requirements:
- Small resolutions (f.i. iPad) it keeps centralized;
- Large resolution it takes (f.i. 20% from the left side).
Unfortunately left: -300px;
doesn't work.
Here is an example.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
#bg-rect-important {
background-color: #656565;
width: 100%;
position: absolute;
left:0; right:0;
min-width: 980px; /* max for iPad */
height: 263px;
}
#base-rect-lime {
background-color: lime;
height:400px;
width:940px;
position: relative;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="bg-rect" id="bg-rect-important">
<div id="base-rect-lime"></div>
</div>
</body>
</html>