I want to setup the following layout to my page:
To split the page in two, I wrote:
<style>
body {
font-family: Arial;
}
.split {
height: 100%;
width: 50%;
position: fixed;
z-index: 1;
top: 0;
overflow-x: hidden;
}
.left {
left: 0;
}
.right {
right: 0;
....
and
<body>
<div class="split left">
.. content layout 1
</div>
<div class="split right">
<div class="so">
some content layout 2
</div>
<div class="layout3">
.... long content ...
</div>
</body>
how can I setup Layout 3 to be scrollable, but not Layout 2?
4
Answers
In your CSS, set the
overflow
property:This will add scrollbars and allow scrolling of the long content in the layout3 box; you can find out more about
overflow
at https://developer.mozilla.org/en-US/docs/Web/CSS/overflow.If you don’t want the horizontal scrollbar, and the content is guaranteed to wrap and never be wider than the box, you can use
instead.
To make the content scrollable, you need to specify a height, and add
overflow-y: auto;
oroverflow-y: scroll;
. This is the extra css:Here is an idea using CSS grid:
Using
flex
: