Bootstrap Material Design表格对齐问题

时间:2017-05-08 21:49:42

标签: html css bootstrap-material-design

对于我正在使用Bootstrap Material Design的网站,并且难以对齐连续的元素(course.namecourse.updatecourse.delete按钮)。

我希望它们与CSS垂直对齐,但vertical-align:middle不起作用。 <tr valign="middle">也没有。

感谢任何帮助。

{% if course_list %}
    <table class="table table-hover">
        <tr>
            <th>Course Name</th>
        </tr>
        {% for course in course_list %}
            <tr>
                <td><a class="text-nowrap" href="{% url "courses.detail" course.id %}">{{ course.name }}</a>
                    {% if course.instructor == user %}
                        <div class="pull-right">
                            {% url 'courses.update' pk=course.id as url %}
                            {% bootstrap_button button_type='link' content='Edit' button_class='btn-warning' href=url %}
                            {% url 'courses.delete' pk=course.id as url %}
                            {% bootstrap_button button_type='link' content='Delete' button_class='btn-danger' href=url %}
                        </div>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
    </table>

1 个答案:

答案 0 :(得分:0)

首先你的表没有响应,要使它像这样响应做结构

<div class="table-responsive">
        <table class="table table-bordered table-striped">
       //rest of your code
         </table>
     </div>

它会使您的表格响应并

.table td {
   text-align: center;   
}

<td class="text-center">some text</td>

使其居中对齐