在表格中的图像之间放置空格

时间:2016-11-11 09:34:46

标签: php html datatable

我的数据表工作正常,在我的行动'列我正在显示图像供用户编辑/删除等。

然而,图像非常接近,我如何在它们之间放置几个空格?

我使用以下代码显示图像;

$row[2] =   "
    <td><a onClick =\"return confirm('Are You Sure You Want To Edit This Ticket?')\" href=$edit>
    <img src=\"edit.png\">
    <td><a onClick =\"return confirm('Are You Sure You Want To Delete This Ticket?')\" href=$delete>
    <img src=\"delete.png\">";

请告诉我如何在两者之间留一个空间?

由于

3 个答案:

答案 0 :(得分:1)

使用层叠样式表(CSS)可以改变HTML元素的外观。

例如:

<style type="text/css">
.spaced {
    display: inline-block;
    margin: 0px 5px 0px 5px;
}
</style>

$row[2] =   "<td><a class=\"spaced\" onClick =\"return confirm('Are You Sure You Want To Edit This Ticket?')\" href=$edit><img src=\"edit.png\"><td><a onClick =\"return confirm('Are You Sure You Want To Delete This Ticket?')\" href=$delete><img src=\"delete.png\">";

答案 1 :(得分:0)

您可以尝试添加     图片之间&nbsp;&nbsp;&nbsp;。这个例子我添加了3个空格。

答案 2 :(得分:0)

$row[2] =   "<td><a onClick =\"return confirm('Are You Sure You Want To Edit This Ticket?')\" href=$edit><img src=\"edit.png\"><td><a onClick =\"return confirm('Are You Sure You Want To Delete This Ticket?')\" href=$delete><img src=\"delete.png\" style="padding:5px;">";

试试这个