pxlcreations
04-27-2010, 11:18 PM
This is confusing me like crazy. I am making a webapp for the iPad but I can't seem to figure out how to keep my divs in a line, then have overflow-x kick in once the divs have hit the edge of the screen. Let me explain some more. I have a div that I set the width at 100% so it will fill the screen width wise. Then I would put more divs inside this div, and give them a float:left so that they would be in a line. This works until it hits the end of the screen, but then it goes to the next line. I want it to stay in one line, and at the end of the screen, overflow-x kicks in so that I can scroll it horizontally. If someone can help me, that would be great. My code is below.
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<div id="dock">
<div id="image">
<a href="#" onclick="toggle_visibility('clock');" style="background-image:url(images/dock/clock.png);width:90px;height:127px;display:block;">
<p style="padding-top:100px;">Clock</p>
</a>
</div>
<div id="image">
<a href="#" onclick="toggle_visibility('clock');" style="background-image:url(images/dock/clock.png);width:90px;height:127px;display:block;">
<p style="padding-top:100px;">Clock</p>
</a>
</div>
</div>
#image{
height:127px;
width:90px;
float:left;
margin:0 10px;
text-align:center;
}
#dock a{
color:black;
text-decoration:none;
font-family:verdana;
font-size:13px;
}
#dock{
width:100%;
height:127px;
overflow-x:scroll;
overflow-y:hidden;
}
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<div id="dock">
<div id="image">
<a href="#" onclick="toggle_visibility('clock');" style="background-image:url(images/dock/clock.png);width:90px;height:127px;display:block;">
<p style="padding-top:100px;">Clock</p>
</a>
</div>
<div id="image">
<a href="#" onclick="toggle_visibility('clock');" style="background-image:url(images/dock/clock.png);width:90px;height:127px;display:block;">
<p style="padding-top:100px;">Clock</p>
</a>
</div>
</div>
#image{
height:127px;
width:90px;
float:left;
margin:0 10px;
text-align:center;
}
#dock a{
color:black;
text-decoration:none;
font-family:verdana;
font-size:13px;
}
#dock{
width:100%;
height:127px;
overflow-x:scroll;
overflow-y:hidden;
}