Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html layout with only part of the page scrolling

Tags:

html

css

I want to create an page layout that is split into 3 parts - one column with fixed width that contain two rows with fixed height. and another column with fixed width, that can potentially contain multiple items (more than fit into view).

I'm looking for a way to make the page scrolling only affect the items column, so that the left side of the screen (first column) remains on view.

Here is a sample image of the layout to better illustrate the meaning:

sample page layout

like image 720
avivr Avatar asked May 18 '15 05:05

avivr


People also ask

How do I make one section scrollable in HTML?

For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.

How do I turn off side scrolling in HTML?

To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML.

How do you add a scrolling page in HTML?

Suppose we want to add a scroll bar option in HTML, use an “overflow” option and set it as auto-enabled for adding both horizontal and vertical scroll bars. If we want to add a vertical bar option in Html, add the line “overflow-y” in the files.


3 Answers

Apply overflow:autofor your right side columns. Look at the following sample HTML.

<div style="width:450px;">
  <div style="float:left; width:300px">
       <div style="height:120px; border:1px solid #ff00ff;">Testing Content</div>
       <div style="height:200px; border:1px solid #fff000;">Sample INformation</div>    
  </div>
 <div style="float:right; width:100px; height:320px; overflow:auto;">
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
   <p>items</p>
  </div>
</div>

SAMPLE DEMO

like image 136
Suresh Ponnukalai Avatar answered Nov 04 '22 07:11

Suresh Ponnukalai


You can use frame or fix the position of left column.

.left
{
    position:fixed;
}
like image 32
Touseef Rehman Avatar answered Nov 04 '22 06:11

Touseef Rehman


Why not float your items container right, then have a left column which is position:fixed?

	.left { position:fixed;width:70% }
	.right { float:right;width:30%; }
	<div>
		<div class="left">
			This content is fixed and does not scroll
		</div>
		<div class="right">
			<ul>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
				<li>item></li>
			</ul>
		</div>
	</div>
like image 31
twsaef Avatar answered Nov 04 '22 08:11

twsaef