在表格行的输入旁边放置按钮

时间:2017-03-07 19:46:39

标签: html css

这就是我现在的表格

表:

1

我正在尝试将小x按钮放在输入文本框旁边。到目前为止,这是我的代码。

<table class="table table-hover">
    <thead class="thead-inverse">
        <th>Clave</th>
        <th>Razón social</th>
        <th>Contacto 1</th>
        <th>Contacto 2</th>
        <th>Contacto 3</th>
        <th></th>
    </thead>
    <tbody>
        <td class="col-md-1">
            <input type="text" name="" class="form-control"/>
        </td>
        <td class="col-md-3">
            <input type="text" name="" class="form-control"/>
        </td>
        <td>
            <input type="text" name="" class="form-control" disabled/>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
        <td>
            <input type="text" name="" class="form-control" disabled/>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
        <td>
            <input type="text" name="" class="form-control" disabled/>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
        <td>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
    </tbody>
</table>

2 个答案:

答案 0 :(得分:0)

你试过了吗?

n.num_courses IN (SELECT MAX(n.num_course) from n);

有一个CSS版本:

<td nowrap></td>

答案 1 :(得分:0)

这是您正在寻找的内容

&#13;
&#13;
td .btn {
  position: absolute;
  margin-top: 7px;
  float: right;
  margin-left: 5px;
}
td input {
  float: left;
}
.spacer {
  padding-left: 30px !important;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table table-hover">
    <thead class="thead-inverse">
        <th>Clave</th>
        <th>Razón social</th>
        <th>Contacto 1</th>
        <th>Contacto 2</th>
        <th>Contacto 3</th>
        <th></th>
    </thead>
    <tbody>
        <td class="col-md-1">
            <input type="text" name="" class="form-control"/>
        </td>
        <td class="col-md-3">
            <input type="text" name="" class="form-control"/>
        </td>
        <td>
            <input type="text" name="" class="form-control" disabled/>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
        <td class="spacer">
            <input type="text" name="" class="form-control" disabled/>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
        <td class="spacer">
            <input type="text" name="" class="form-control" disabled/>
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
        <td class="spacer">
            <a title="Quitar" class="btn btn-danger btn-xs"><span class="fa fa-times"></span></a>
        </td>
    </tbody>
</table>
&#13;
&#13;
&#13;