
Untitled
By: a guest on
May 11th, 2012 | syntax:
None | size: 2.35 KB | hits: 14 | expires: Never
html, how to make elements not shift when browser zooms?
#in .html file
<style type="text/css">
div.box {
position: relative;
height: 30px;
}
div.box p#id1 {
position: absolute;
margin-left: 0px;
}
div.box p#id2 {
position: absolute;
margin-right: 0px;
}
</style>
...
<div class="box">
<p id="id1">ID1</p>
<p id="id2">ID2</p>
</div>
-------------------------------------------------------------
| |
|ID1 ID2|
| |
-------------------------------------------------------------
---------------------------------
| |
|ID1 ID2|
| |
---------------------------------
-------------------------------------------------------------
| |
|ID1 ID2|
| |
-------------------------------------------------------------
-----------------------------------------------------------
| |
|ID1 I|
| |
-----------------------------------------------------------
---------------------------------
| |
|ID1 |
| |
---------------------------------
<style type="text/css">
div.box {
position: relative;
height: 30px;
min-width:400px;
}
div.box p#id1 {
position: relative;
margin-left: 0px;
display:inline-block;
float:left;
clear:none;
}
div.box p#id2 {
position: relative;
margin-right: 0px;
display:inline-block;
float:right;
clear:none;
}
</style>
div.box {
position: relative;
height: 30px;
width: 90%;
min-width: 500px;
}
div.box p#id1 {
float: left;
}
div.box p#id2 {
float: right;
}