How can you use negative margin when positioning a fixed element?
I am trying to position an element with position:fixed; wi开发者_StackOverflow社区thin an expanding(liquid) element.
I want the element to stay to the right no matter how wide the display gets.
box1 is inside box2
box2 is the center column and is expandable with browser size
box1 is fixed and should float above the right edge of box2(center column)
Try this:
.box1 {
position:fixed;
right:0;
margin-right:-20px;
}
You should be able to achieve this effect by making box2 position:relative;
, and then setting box1 to position:absolute; bottom:0; right:0;
... if I understand you correctly.
As best I can tell from your query:
element {
float:right;
margin-left:x;
z-index:10;
}
box2 {
width:80%;
z-index:-10;
}
box1 {
margin-left:20%;
z-index:0;
}
You probably just want to float-right.
精彩评论