幅 400 ピクセルの DIV があり、それぞれ幅 400 ピクセル、高さ 600 ピクセルの 2 つの DIV が並んでいます。両方の DIV の幅は固定されていますが、高さは変更できます。DIV 内をスクロールせずに、2 番目の DIV を非表示にして、最初の DIV を完全に表示したいと思います。
私の解決策は、overflow-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>
見える#schools-list
はずなのになぜか隠れてしまうoverflow-x: hidden
。#schools-container