Anyone tell me that how to fix all elements with css, means whatever we do with the browser's height and width then elements should not move? or elements should not move relative to the browser' height and width and page should also be scroll able?
Asked
Active
Viewed 1,024 times
0
-
I believe you're looking for `position:absolute`. – GentlePurpleRain Aug 29 '14 at 15:35
-
I don't mean to be rude, but any css tutorial will teach you that... You just have to look for it a little! – LcSalazar Aug 29 '14 at 15:37
-
Give the `body` element a fixed width and place your elements in it. – Nico O Aug 29 '14 at 15:40
-
No I don't mind.I believe even sometimes experts do little mistakes , actually. I tried position: absolute but div is still moving when I resize my browser. – Awais Ahmed Aug 29 '14 at 15:44
1 Answers
1
Applying position: absolute
to an element will cause it remain fixed relative to the document. That is, it will scroll with the document.
Applying position: fixed
will cause it to remain fixed relative to your browser window. That is, if you scroll the document it will not move.
With each of these position
values, you can specify some combination of top
, right
, bottom
and left
to specify their position. For example, the following style will fix an element very close to the top right of the browser window (it will not scroll with the document):
.topright {
position: fixed;
top: 5px;
right: 5px;
}

BudgieInWA
- 2,184
- 1
- 17
- 31