πŸ’» Programming/CSS

[CSS] 19. Scrollbars ( μŠ€ν¬λ‘€λ°” )

μΌ€μ΄μΉ˜ 2016. 6. 12. 18:07
이번 ν¬μŠ€νŒ…μ—μ„œλŠ” CSSλ₯Ό μ΄μš©ν•΄μ„œ μŠ€ν¬λ‘€λ°”λ₯Ό μ„€μ •ν•˜λŠ” 방법에 λŒ€ν•΄μ„œ μ•Œμ•„λ³΄λ„λ‘ ν•˜κ² μŠ΅λ‹ˆλ‹€.

 

CSS 속성 쀑에 overflow λΌλŠ” 속성이 μžˆλŠ”λ° 이녀석은 μ»¨ν…νŠΈ λ°•μŠ€λ³΄λ‹€ λ§Žμ€ μ–‘μ˜ μ»¨ν…νŠΈκ°€ λ“€μ–΄κ°ˆ κ²½μš°μ— μ»¨ν…νŠΈκ°€ μ–΄λ–»κ²Œ 보여져야 ν•˜λŠ”μ§€μ— λŒ€ν•΄μ„œ μ„€μ •ν•΄μ£ΌλŠ” μ†μ„±μž…λ‹ˆλ‹€.

 

이 속성에 λŒ€ν•œ 속성값은 λ‹€μŒκ³Ό 같은 값듀이 μžˆμŠ΅λ‹ˆλ‹€. 

ValueDescription
visibleAllows the content to overflow the borders of its containing element.
hiddenThe content of the nested element is simply cut off at the border of the containing element and no scrollbars is visible.
scrollThe size of the containing element does not change, but the scrollbars are added to allow the user to scroll to see the content.
autoThe purpose is the same as scroll, but the scrollbar will be shown only if the content does overflow.

 

λ‹€μŒ 예제λ₯Ό λ³΄μ‹€κΉŒμš”. 

<style type="text/css">
.scroll{
 display:block;
 border: 1px solid red;
 padding:5px;
 margin-top:5px;
 width:300px;
 height:50px;
 overflow:scroll;
 }
.auto{
 display:block;
 border: 1px solid red;
 padding:5px;
 margin-top:5px;
 width:300px;
 height:50px;
 overflow:auto;
 }
</style>
<p>Example of scroll value:</p>
<div class="scroll">
I am going to keep lot of content here just to show
you how scrollbars works if there is an overflow in
an element box. This provides your horizontal as well
 as vertical scrollbars.
</div>
<br />
<p>Example of auto value:</p>
<div class="auto">
I am going to keep lot of content here just to show
you how scrollbars works if there is an overflow in
an element box. This provides your horizontal as well
as vertical scrollbars.
</div>

 

κ²°κ³ΌλŠ” μ•„λž˜μ™€ κ°™μŠ΅λ‹ˆλ‹€. ( κ²°κ³Ό 이미지 )

 

 

 μ§μ ‘ νŽ˜μ΄μ§€λ₯Ό λ§Œλ“€μ–΄μ„œ κ΅¬ν˜„ν•΄λ³΄μ„Έμš”. ^-^ 

 

 

 

 

 

Reference : http://www.tutorialspoint.com/css/css_scrollbars.htm