我也只是在寻找这个“问题”。但我却高兴不起来与形式的按钮,我只是想获得按钮像操作类:
所以我发现我2个解决方案:
解决方案1:裹在按钮用CSS类“动作”
<span class="action">
<?php
echo $this->Html->link("Send Again", "url");
?>
</span>
的CSS类action
跨度已经意味着在cake.generic样式表。所以这将是一个很好的按钮。
解决方案2:复制的CSS样式.actions a
该解决方案是以上的除Alvaro's one。我还不能评论,所以我必须为此做一个额外的答案。
所以,我没有使用Alvaro的css,因为它们是表单按钮,与原来的略有不同。所以我只是在cake.generic.css
中搜索.action a
的样式,并将它们复制到我自己的css文件中,并将选择器更改为a.button
。
那么现在你可以使用这个没有任何包装生成按钮:
<?php echo $this->Html->link("Send Again, "url", ["class" => "button"]) ?>
为CSS的CakePHP的版本2.6.2 :
a.button {
font-weight: normal;
padding: 4px 8px;
background: #dcdcdc;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc);
background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc);
background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
background-image: -o-linear-gradient(top, #fefefe, #dcdcdc);
background-image: linear-gradient(top, #fefefe, #dcdcdc);
color: #333;
border: 1px solid #bbb;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
text-shadow: #fff 0px 1px 0px;
min-width: 0;
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
-webkit-user-select: none;
user-select: none;
}
a.button:hover {
background: #ededed;
border-color: #acacac;
text-decoration: none;
}
a.button:active {
background: #eee;
background-image: -webkit-gradient(linear, left top, left bottom, from(#dfdfdf), to(#eee));
background-image: -webkit-linear-gradient(top, #dfdfdf, #eee);
background-image: -moz-linear-gradient(top, #dfdfdf, #eee);
background-image: -ms-linear-gradient(top, #dfdfdf, #eee);
background-image: -o-linear-gradient(top, #dfdfdf, #eee);
background-image: linear-gradient(top, #dfdfdf, #eee);
text-shadow: #eee 0px 1px 0px;
-moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
border-color: #aaa;
text-decoration: none;
}
希望这将有助于家伙问题提出后三年。 :D
就是这样Nebojsac,但无法用来包围这个按钮?在这种格式与将是一个带有href的文本。 – user1511579
史蒂夫回答说,我看到 –
完美,谢谢:) – MoOoG