Cakephp的新功能遇到了我必须将文本和图像作为链接的场景。
幸运的是它是成功的,但是我注意到我的链接上有一个下划线,我必须删除它,正如你在下面的图片中看到的+关于我如何制作它的代码:
Cakephp代码:
echo $this->Html->link(
$this->Html->image('img/f.png', array('height' => '40', 'width' => '40'))
. '' . ('forensics express    '),
'http://example.com', array('escape' => false));
通常只需添加以下内容即可:
style="text-decoration:none"
在css中,但是因为我是蛋糕的新手,所以我不知道如何设置我可以用于css的id或类的语法,或者我喜欢的语法,直接添加数组中的 style =“text-decoration:none” 。我试过这个,但它不起作用。
echo $this->Html->link(
$this->Html->image('img/f.png', array('height' => '40', 'width' => '40'))
. '' . ('forensics express    '),
'http://example.com', array('escape' => false,'style'=>'text-decoration:none'));
我该如何解决这个问题?任何帮助表示赞赏
答案 0 :(得分:5)
这可能会有所帮助
echo $this->Html->link(
$this->Html->image('img/f.png', array('height' => '40', 'width' => '40'))
. '' . ('forensics express    '),
'http://example.com', array('escape' => false,'class'=>'no-decoration'));
在样式表中,您可以创建此类
.no-decoration{
text-decoratino:none;
}
您可以将其用作参考链接:How to call CSS class on a CakePHP Html->link?
答案 1 :(得分:2)
只需将其设置在您的css (样式表)中,而不是内联代码。
a {text-decoration:none;}