I want to make make a div
always showing on the left-most s开发者_如何转开发ide of the browser window, ], would you give me some hints?
Try this:
div#mydiv {
position: fixed;
left: 0;
}
You'll probably want to add top
or bottom
to that as well so that it doesn't sit at the top of the screen.
Something like:
div#mydiv {
position: fixed;
left: 0;
top: 200px; /* 200px from top */
}
or:
div#mydiv {
position: fixed;
left: 0;
bottom: 200px; /* 200px from bottom */
}
or:
div#mydiv {
position: fixed;
left: 0;
top: 50%; /* Half way down the side */
}
set its position
to fixed
and its left
to 0px
#fixedLeft{
position:fixed; /* now it will stay fixed on the screen, even while you scroll*/
left:0px; /* it will be stuck to the left*/
top:50%; /* it will be in the middle (vertically)*/
}
精彩评论