Ответ 1
Как вы сделали два div (с абсолютной позицией), лишайте правила переполнения!
Вам нужно изменить тип позиции (до нормального/не абсолютного), и я предлагаю использовать поплавки, наконец, контейнерный div, для которого вы хотите применить переполнение, должен иметь способ подгонки, например, поместить div в конец с clear: both
(в случае использования поплавков).
EDIT: я просто попробовал, и вы можете скрыть второй div, следуя верхнему предложению и добавив еще один окружающий div внутри с очень большой шириной и изменив overflow-x
на overflow
для главного контейнера div.
Вот так:
<div id="schools-container">
<div id="schools-container-inside">
<div id="schools-list"> One </div>
<div id="boards-list"> Two </div>
</div>
</div>
И затем CSS (я прокомментировал оригинальный не использованный CSS и добавил новый класс div в конце):
#schools-container {
width: 400px; /* Set the width of the visible portion of content here */
background-color: fuchsia;
position: relative;
/*overflow-x: hidden;*/
overflow: 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;
*/
float: left;
}
#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;
*/
float: left;
}
#schools-container-inside {
width: 10000px;
overflow: hidden;
}
JsFiddle здесь: http://jsfiddle.net/MbMAc/