html - `input` 在表格中的位置

标签 html css

有人能解释一下 input 这怎么可能吗?类型为“submit”的虽然在第三个 <tr> 内,但位于左上角 我可以通过 margin 将其位置更改为正确的位置和 position属性,但在这种情况下根本不需要它们。 看代码:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Home</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
        <div class="container">
            <div style="border:2px solid black;margin-top:10%;">
                <div class="row">
                    <table style="margin-left:10%;width:85%;" class="table table-hover">
                        <thead>
                            <tr>
                                <th>album name</th>
                                <th>Number of images</th>
                                <th>Order</th>
                            </tr>
                        </thead>

                        <tr>
                            <td>
                                <input placeholder="album's name" name="album_name">
                            </td>

                            <td>
                                <input placeholder="#of images eg.8" id="no_of_images" name="NoOfImages">
                            </td>

                            <td>
                                <input placeholder="order between other albums eg. 1" name="album_order">
                            </td>
                        </tr>

                        <tr>
                            <input  style="" class="btn btn-info btn-md" value="Submit" name="submit">

                        </tr>
                    </table>

                    <table style="margin-top:10%;" id="images_table" class="table table-hover">
                    </table>
                </div>
            </div>
        </div>
    </body>
</html>

最佳答案

像这样插入 td:

<td> <---------------
     <input  style="" class="btn btn-info btn-md" value="Submit" name="submit">
</td> <--------------

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
    <div style="border:2px solid black;margin-top:10%;">
        <div class="row">
            <table style="margin-left:10%;width:85%;" class="table table-hover">
                <thead>
                    <tr>
                       <th>album name</th>
                       <th>Number of images</th>
                       <th>Order</th>
                    </tr>
                </thead>
                    <tr>
                        <td>
                           <input placeholder="album's name" name="album_name">
                        </td>

                        <td>
                            <input placeholder="#of images eg.8" id="no_of_images" name="NoOfImages">
                        </td>

                        <td>
                            <input placeholder="order between other albums eg. 1" name="album_order">
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <input  style="" class="btn btn-info btn-md" value="Submit" name="submit">
                        </td>
                    </tr>
            </table>
            <table style="margin-top:10%;" id="images_table" class="table table-hover">
            </table>
        </div>
    </div>
</div>

关于html - `input` 在表格中的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45530040/

相关文章:

php - 如何删除文本和表格之间的空格?

javascript - 如何通过 Electron 应用程序中的 navigator.geolocation 获取当前位置?

html - 需要更改 Bootstrap 插入符的指向位置

html - 将文本片段对齐到同一行

html - 选项卡大小设置不正确

css - 如何使用 CSS 在另一个图像之上显示图像(透明)

javascript - JSON 中的 HTML 不存在 "should"

css - 防止 Bootstrap 轮播标题重叠

javascript - Chrome 和 IE 上的 html 表格并排问题

css - 响应式棋盘问题