First of all im new programmer, so dont judge quickly :). Anyways ive been struggling with this problem for some time now. The problem is when im resizing(scaling whatever) the window, it messes around with ALL my elements. When resizing my website, you should just see less, than before. Not move around elements.
Here's the code:
HTML:
<div id="leftblock">
</div>
<div id="rightBlock">
</div>
CSS:
#leftblock {
margin-left: 20%;
background-color: red;
float: left;
height: 100px;
width: 3px;
}
#rightBlock {
margin-right: 20%;
background-color: red;
float: right;
height: 100px;
width: 3px;
}
To be sure what i mean, test the code in an editor, and then try resize the window.
jsFiddled here
If you don't want them to move around, place the elements in a fixed size parent container.
DEMO
#container {
width: 1000px;
}
#leftblock {
margin-left: 20%;
background-color: red;
float: left;
height: 100px;
width: 3px;
}
#rightBlock {
margin-right: 20%;
background-color: red;
float: right;
height: 100px;
width: 3px;
}
<div id="container">
<div id="leftblock">
</div>
<div id="rightBlock">
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With