我也只是在尋找這個「問題」。但我卻高興不起來與形式的按鈕,我只是想獲得按鈕像操作類:
所以我發現我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