У меня есть DIV размером 400 пикселей шириной, содержащий два DIVs бок о бок, каждый с шириной 400 пикселей и высотой 600 пикселей. Ширина обоих DIVs фиксирована, однако высота может меняться. Я бы хотел скрыть второй DIV и показать первый полностью, без прокрутки внутри DIV.
Мое решение, я думал, должно было скрыть переполнение-x. Это также скрывает и переполнение y.
Здесь мой код:
#schools-sub-nav {
}
#schools-container {
width: 400px; /* Set the width of the visible portion of content here */
background-color: fuchsia;
position: relative;
overflow-x: hidden;
}
#schools-list {
width: 400px; /* Set the width of the visible portion of content here */
height: 600px; /* Delete the height, let the content define the height */
background-color: purple;
position: absolute;
top: 0;
left: 0;
}
#boards-list {
width: 400px; /* Set the width of the visible portion of content here */
height: 600px; /* Delete the height, let the content define the height */
background-color: green;
position: absolute;
top: 0;
left: 400px;
}
<div id="schools-sub-nav"> <a href="#schools-list">Schools List</a> // <a href="#boards-list">Boards List</a> </div>
<div id="schools-container">
<div id="schools-list"> One </div>
<div id="boards-list"> Two </div>
</div>