Ask Your Question
0

How can DIVs be aligned on top of each other in CSS irrespective of the zoom level?

asked 2023-04-02 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-06 12:00:00 +0000

djk gravatar image

One way to achieve this in CSS is by using absolute positioning with top and left properties set to 0 for each div. This ensures that each div is positioned at the top left corner of its parent container. Additionally, the parent container should have a relative positioning to act as a reference point for the absolute positioning of the child divs.

For example:

.parent-container {
  position: relative;
}

.child-div {
  position: absolute;
  top: 0;
  left: 0;
}

With this code, the child divs will be positioned on top of each other, aligned to the top left corner of the parent container, regardless of the zoom level.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-04-02 11:00:00 +0000

Seen: 8 times

Last updated: Aug 06 '22