【发布时间】:2013-11-25 14:05:05
【问题描述】:
所以我有 24 个按钮,现在看起来像:
应该是这样的(我的意思是按钮的位置)
这是我的按钮代码:
$info = getdate();
$date = $info['mday'];
for($i=1;$i<=24;$i++)
{
if($i==$date)
{
Echo "<input type='button' class='imgClass' onclick='issokantisLangas();' value='".$i."' src='deze.png'/>";
}
else
{
Echo "<input type='button' class='imgClass1' src='deze.png' value='".$i."' disabled />";
}
}
这是按钮的 CSS:
<style type="text/css">
.imgClass {
background-image: url(deze.png);
background-position: 0px 0px;
background-repeat: no-repeat;
background-size:100% 100%;
width: 60px;
height: 60px;
border: 0px;
color:#ed1c24;
font-weight:bold;
font-size:20px;
}
.imgClass:hover{
background-position: 0px 0px;
border: 2px solid white;
}
.imgClass:active{
background-position: 0px 0px;
}
.imgClass1 {
background-image: url(deze.png);
background-position: 0px 0px;
background-repeat: no-repeat;
background-size:100% 100%;
margin: 10px 10px 10px 10px;
width: 60px;
height: 60px;
border: 0px;
color:#ed1c24;
font-weight:bold;
font-size:20px;
}
</style>
当我用不同的数字更改这一行margin: 10px 10px 10px 10px; 时,所有按钮的移动都相似。我需要为每个按钮设置特定位置。怎么做?谢谢。
【问题讨论】:
标签: css button for-loop styles position