Click here to Skip to main content
15,894,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi I have A div

.Test
{
Width:500px;
height:500px;
background-color:Red;
}

HTML
<div class="Test">

</div>


i Want Set ScrollBar For This Div
both Vertical and Horizintal Scroll


thanks so much
Posted

 
Share this answer
 
Comments
Seyed Ahmad Mirzaee 28-Aug-12 8:59am    
in Opera Not Show Please Check It

thanks
i Founded

i Use Overflow:Scroll
 
Share this answer
 
Setting the overflow will take care of scrollbars, but you need to set the height of div also. If the height attribute is not set, the div will grow vertically as tall as it needs to, and scrollbars wont be needed.

See Example here[^].


--Amit
 
Share this answer
 
Comments
Seyed Ahmad Mirzaee 28-Aug-12 8:44am    
When Use OverFlow:Scroll and set Height:100px
but Scroll in X Pilot Is Not Work When A string Is Very Long!
if Use this string inside Div:sssssssssssssssssssssssssssssssssssss...
then Div Only Show ssssssssssssssss
and Not Show Reminded string
please Help me
thanks
_Amy 28-Aug-12 9:11am    
Set the height and width both for the div. :)
Set overflow property to either hidden, visible, auto and scroll depending on your requirement.

CSS
.Test
{
Width:500px;
height:500px;
background-color:Red;
overflow:scroll;
}
 
Share this answer
 
XML
<html>
<head>
<style type='text/css'>
.dvContent
{
Width:200px;
height:100px;
background-color:gray;
overflow:scroll;
}
</style>
</head>
<div class='dvContent'>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
<input id='txtTest'  type="text"/>
</div>
</html>
 
Share this answer
 
hiii,
just change
CSS
.Test
{
Width:500px;
height:500px;
background-color:Red;
overflow:auto;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900