CHAPTER#1: OVERFLOW PROPERTY
Mademoiselle; a layout tutorial threadSo now, I have free time and thought I must post something here. And in this chapter, we're gonna discuss the overlow propery.
Overflow propery: What does it do?
The overflow propery acts as something that specifies whatever will happen when there is an overflow in the content. Like, when you have a div and the text exceeds the height of your div, this is where the overflow gets in action. The overflow propery has the following attributes:
Visible - default (nothing to explain for real).
Hidden - the excess content is clipped. E.g.
Scroll - the content is clipped, yet there is a scrollbar.
blah yes you've read that right.
Auto - if the content exceeds your div., there will be a scrollbar automatically
blah yes you've read that right. (without excessive content)
blah yes you've read that right. (with excessive content)
I think that's all I have to discuss about the attributes? So now I'm going to teach a technique most of the coders here use.
Shrinking the scrollbar.
How to do it exactly? Here's the basic code structure I prefer to use.
< div style="float:left;width:300px;height:270px;margin-left:0px;margin-top:0px;padding:0px;text-align:justify;background-color:transparent;margin-bottom:0px;line-height:13px;overflow:hidden;padding:5px ">
< div style="float:left;width:297px;height:252px;margin-left:0px;margin-top:0px;padding:10px;text-align:justify;background-color:transparent;margin-bottom:0px;line-height:13px;overflow:auto;padding:10px ">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer semper nulla erat, in tincidunt est vestibulum et. Nulla blandit enim vitae leo dapibus fringilla. Maecenas ultrices ultricies nibh ut maximus. Ut sed purus ut ante malesuada euismod at eget erat. Quisque cursus nunc et erat eleifend ornare. Donec hendrerit auctor augue ac dapibus. Sed sodales turpis sodales ultrices pharetra. Sed eu malesuada ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis blandit laoreet viverra. Vivamus efficitur laoreet quam, maximus gravida lacus lacinia eu. Morbi sollicitudin rutrum tristique. Fusce pretium auctor mauris id scelerisque. Donec dignissim leo vel felis placerat dapibus. Maecenas augue purus, pretium eget ligula ut, consectetur rhoncus justo. Phasellus at sapien in velit dictum tincidunt et in leo. Duis vehicula odio nec mi gravida, quis hendrerit enim mollis. Vivamus a pretium est. Vivamus facilisis nisi vel elementum aliquet.
< /div >
< /div >
Output:
How did I do that? Well, I just added a div with the "overflow:hidden" and then under that, I added another div with the "overflow:auto" to add scrollbars and enclose it with two(2) < /div > tags (one for the hidden div and the other for the auto div). And the one with auto must have smaller/bigger width (it all depends on your padding). But if they don't have padding, or has the same padding size, most likely the width of the one with hidden attribute would be width:300px and the one with auto would be width:297px (just the same with my example yas) and it won't be so hard to play with the width property so there should be no problem for you.
Also, the hidden attribute does a lot of things. For example clipping an image like this
But there must be an inner div with the width that has the same value as your image so it won't shrink (esp. with the new, blue aff layout). Here is the code I used for that. ^
< div style="float:left;overflow:hidden;height:123px ">
< div style="float:left;width:420px ">
< img alt="fRRgchT.png" src="http://37.media.tumblr.com/tumblr_mdve4xBg5M1rfp1lho1_500.gif" style="height:236px;width:420px;margin-left:-40px;opacity:1;" / >
< /div >
< /div >
Comments