如何在ASP.Net MVC5中设置html表的宽度属性

时间:2016-12-25 09:51:12

标签: html css asp.net asp.net-mvc html-table

我正在尝试将滚动条添加到我的html表格中,然后根据我的喜好更改表格列的宽度,但表格的列宽度不会受到影响。这是我的表格HTML。

基本上我想要的是表的宽度应该是父容器的宽度(tbody->继承如下)。然后将列添加到表中并根据自己的喜好设置其宽度。如果表需要水平滚动,它应该出现。问题是下面的标记没有改变列宽,因此滚动不能按预期工作。

<?php 
$args = array(
    'post_type'=> 'theslider',
    'orderby'   => 'date',
    'order'     => 'DESC'
);              

$the_query = new WP_Query( $args );
if($the_query->have_posts() ) : 
    while ( $the_query->have_posts() ) : $the_query->the_post(); 

        the_title();

    endwhile; 

else: 

    echo '<p>Nothing Here.</p>';

endif; 

wp_reset_postdata(); 

?>

P.S:这是Visual Studio 2013的默认ASP.Net MVC 5应用程序,因此css和bootstrap代码保持不变。

1 个答案:

答案 0 :(得分:0)

表有width属性。你可以利用它。 查看http://www.w3schools.com/tags/att_table_width.asp>here