Программисты Html
Anonymous
Почему моя позиция: абсолютный элемент все еще удается занять место?
Сообщение
Anonymous » 01 апр 2025, 02:12
Я пытаюсь воссоздать своего рода раскрывающееся меню с несколькими вариантами при нажатии. Тем не менее, Div, который я хочу появиться в позиции Absolute, все еще заполняет пространство, заставив Div прокручивать. />
Код: Выделить всё
cart_checkbox_label = document.querySelectorAll('.cart_checkbox_label');
select_cart_drop = document.querySelectorAll('.select_cart_drop');
for (let i = 0; i < cart_checkbox_label.length; i++) {
cart_checkbox_label[i].addEventListener("click", () => select_cart_drop[i].style.display = "flex";)
}< /code>
.select_cart {
display: flex;
position: relative;
width: 70%;
border: 1px solid lightgray;
}
.select_cart_drop {
position: absolute;
*/display: none;
/*
flex-direction: column;
top: 0;
left: 0;
width: 100%;
z-index: 1;
}< /code>
Quantité :
0 (supprimer)
1
2
3
4
5
6
7
8
9
10 +
Подробнее здесь:
https://stackoverflow.com/questions/795 ... take-space
1743462764
Anonymous
Я пытаюсь воссоздать своего рода раскрывающееся меню с несколькими вариантами при нажатии. Тем не менее, Div, который я хочу появиться в позиции Absolute, все еще заполняет пространство, заставив Div прокручивать. /> [code]cart_checkbox_label = document.querySelectorAll('.cart_checkbox_label'); select_cart_drop = document.querySelectorAll('.select_cart_drop'); for (let i = 0; i < cart_checkbox_label.length; i++) { cart_checkbox_label[i].addEventListener("click", () => select_cart_drop[i].style.display = "flex";) }< /code> .select_cart { display: flex; position: relative; width: 70%; border: 1px solid lightgray; } .select_cart_drop { position: absolute; */display: none; /* flex-direction: column; top: 0; left: 0; width: 100%; z-index: 1; }< /code> Quantité : 0 (supprimer) 1 2 3 4 5 6 7 8 9 10 + [/code] Подробнее здесь: [url]https://stackoverflow.com/questions/79547397/why-does-my-positionabsolute-element-still-manage-to-take-space[/url]