An image link won't work on codeigniter
Can anybody explain to me why this won't work on CodeIgniter?
.linkBack{
background-image:url('/myBlog/CodeIgniter_1.7.2/pictures/arrow.gif');
display:block;
height:58px;
width:105px;
text-indent:-999px;
}
<div class="linkBack"><?=anchor('myBlog', 'Back to Blog');?></div>
while this would work perfectly:
#linkBack {
background-image:url(/myBlog/CodeIgniter_1.7.2/pictures/arrow.gif);
position:fixed;
left:10px;
bottom:10px;
display:block;开发者_运维知识库
height:58px;
text-indent:-9999px;
width:100px;
}
<a href="/myBlog/CodeIgniter_1.7.2/index.php/myBlog" id="linkBack">Back to Blog</a>
it is an image used as a link...
With the url
helper loaded either via the contoller ($this->load->helper('url');
) or via the helper array in /system/application/config/autoload.php; try:
anchor('myBlog',img(array('src'=>'/myBlog/CodeIgniter_1.7.2/pictures/arrow.gif','border'=>'0','alt'=>'My Blog')));
It may be something as simple as being more specific in your CSS selector (e.g. a#linkback).
The solution for getting img()
to work is to make sure the HTML helper is loaded in autoload.php like this:
$autoload['helper'] = array('url','html');
精彩评论