Vertical Scroll

⎡Designs of a Muse⎦« Layout Tutorials »
 
 
 Vertical Scroll
Recently I've started seeing a lot more people using the scroll function for their textboxes rather than having stories that just keep going down the page.

Making a text box scroll is very simple, add the following code inside the < div > and < /div > tags:

overflow:auto;

This means that the text box will automatically create a scroll bar once the contents of the text box starts to go outside the set width or height. As of yet, I haven't been able to determine how to only activate scroll in one direction using code. I'll show you how to do that in the next tutorial based on text box dimensions.

Another interesting thing you can do, is make a text box that scrolls without a visible scroll bar. To do this, you need to create a text box within a text box:

 

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.
 

You will notice that this text box will now scroll down, but the scroll bar is still visible. To make the bar 'invisible', you need to make the outer box (red), smaller than the box holding your content (black).

The < div > code for this is slightly different than before. The 'red' box will need "overflow:hidden;" while the 'black' box will need "overflow:auto;".

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.
 
As you can see, the text is a bit cut-off on the right hand side, but this can be easily fixed by changing the margins and padding values of the text boxes (I'll cover this at a later date). Obviously, if you are trying to use this function, you would make the backgrounds and border color the same. 

Please note that I have also shifted the inner box to the left in order to have the text show up, this was done using margins.
   

 


S
C
R
O
L
L
Like this story? Give it an Upvote!
Thank you!

Comments

You must be logged in to comment
rolling-thunder #1
Chapter 8: Just a question before I try this out--
Does this work the same way for pictures?
Like if I was to make a horizontal scroll for pictures, would it work the same way as with boxes?
-xttran #2
Chapter 4: I'm still very confused on how to make a vertical scroll ;-; /sobs/
Rose_17 #3
Chapter 1: Hello !! May I ask? Because I've been trying to apply the borders but can't. Do I copy the code you provided to the source? or something else?
CaramelMilkTea98
#4
Chapter 6: Waiting for more tutorials authornim~ I've been wanting to try making a layout or something to make my story more interesting haha. Thank you so much for writing these^^