【问题标题】:Twitter Bootstrap Table Column - 1st Table Shorter Column Widths than 2nd TableTwitter Bootstrap 表列 - 第一个表的列宽比第二个表短
【发布时间】:2013-01-16 04:03:38
【问题描述】:

我正在尝试将 .haml 与 Twitter Bootstrap 一起使用来创建两个表。问题是我的第二个表格渲染得很好,但我的第一个表格文本少得多,似乎在页面上无休止地延伸。如何将我的第一个表格列宽设置为小,与第二个表格的宽度不同?我试过:class=> "table table-condensed" 但还是太大了。

%html
  %head
    %link(rel="stylesheet" href="css/bootstrap.css")
    %link(rel="stylesheet" href="css/my.css")
    %title Working Units
  %body
    %p  
    %p These are the units that are updating. 
%table{:class => "table table-bordered"}
  %thead
    %tr 
      %th Job 
      %th Age 
  %tbody
    - @plines.each do |row|
      %tr 
        - row.split(/[-,]/).each do |column|
          %td= column
%p These are the units that are not updating. 
%table{:class => "table table-bordered"}
  %thead
    %tr 
      %th Job 
      %th Age 
      %th Time
  %tbody
    - @mlines.each do |row|
      %tr 
        - row.split(/[-,]/).each do |column|
          %td= column
%a{:href=>"/"} Back to the form

【问题讨论】:

    标签: twitter-bootstrap haml


    【解决方案1】:

    将表格包裹在具有特定宽度的div 中:

    :css
        .halfsize {
              width: 50%;
        }
    .halfsize
        %table{:class => "table table-bordered"}
          %thead
            %tr 
              %th Job 
              %th Age 
          %tbody
            - @plines.each do |row|
              %tr 
                - row.split(/[-,]/).each do |column|
                  %td= column
    

    【讨论】:

    • 谢谢;这很有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 2021-11-27
    • 1970-01-01
    • 2013-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多