Answer the question
In order to leave comments, you need to log in
An absolutely positioned element is aligned with the viewport. Why?
The question is.
There is a structure:
<a href="#" class="banner">
<div class="btn"></div>
</a>
.banner {
display: block;
height: 100%;
background: transparent url("moscow.jpg") no-repeat scroll 50% top;
filter: none;
margin-left: 0px;
margin-top: 0px;
opacity: 0.995705;
width: 100%;
visibility: visible;
position: absolute;
transform-origin: 50% 50% 0px;
transform: translate3d(0px, 0px, 0px);
}
.btn {
width: 232px;
height: 39px;
bottom: 87px;
left: 539px;
position: absolute;
z-index: 200;
background: transparent;
}
Answer the question
In order to leave comments, you need to log in
Found the reason.
The width of the parent block is calculated dynamically using js and is equal to the current viewport width (with the maximum width = 1900).
is calculated not when resizing, but when rendering the parent block. (gallery slide)
so the parent of the .banner element is NOT wider than the viewport, it fits in the width of the window.
the background image is displayed at 100% scale and its width is again 1900.
after all, I blunted.)
thanks for the answers.
And the .banner's parent has position:relative? if not, then how else can he position himself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question