我遇到了问题而且我似乎无法在我的删除和编辑按钮上放置图像图标我已经在我的CSS中设置了div类并将其设置为风格,但图像仍然没有show.what可能有什么问题?
HTML
<?php
$this->table->set_heading("Name","Nationality","Contact Number","Number of Guest","Date of Arrival","Time","Pickup Location","Package","Other Request","Delete Record","Edit Record");
$qry = $this->db->like('name',$search_key)->order_by('date')->get('booking');
if ($qry->num_rows > 0) {
foreach ($qry->result() as $row) {
$this->table->add_row(anchor('site/print_records/'.$row->id, $row->name, 'target="_blank"'),$row->nationality,$row->contactnum,$row->number_of_guest,$row->date,$row->time,$row->pickup,$row->package,$row->request,anchor('site/delete/'.$row->id, "<div class='deleteico'></div>),anchor('site/update/'.$row->id, "<div class='editico'></div>));
}
}
else{
echo "No records found!";
}
echo $this->table->generate();
?>
CSS
#deleteico{
background-image: url('../pictures/delete_icon.png');
}
#editico{
background-image: url('../pictures/edit_icon.png');
}
答案 0 :(得分:2)
您在代码中使用class
并将css应用于id
选择器。
如果要使用类,请将css更改为以下内容:
.deleteico{
background-image: url('../pictures/delete_icon.png');
}
.editico{
background-image: url('../pictures/edit_icon.png');
}
#
用于选择ID,.
用于类。
注意:正如@ skip405所提到的那样,您需要在css中设置width
和height
,否则div将大于0x0,因此不会显示任何内容。
答案 1 :(得分:0)
尝试在您的行李箱内添加空格:
答案 2 :(得分:0)
您需要将width
的{{1}}和height
添加到background-image
和#deleteico
ID。然后向其添加#editico
,并在代码中将其从
更改为id
。
例如,
class
希望这有帮助。