Reputation: 4220
I want to make make a div
always showing on the left-most side of the browser window, ], would you give me some hints?
Upvotes: 2
Views: 6287
Reputation: 196162
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)*/
}
Upvotes: 2
Reputation: 41833
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 */
}
Upvotes: 5