0

如何减小日期列的宽度(“MON”、“TUES”等)以匹配“MON”或“TUES”等所需的空间?换句话说,我想设置宽度日列的长度等于列标题的长度。

http://jsfiddle.net/BnLEh/

<div ng-app="MyModule">
<div ng-controller="Controller">
    <table border='1' width='200'>
        <tbody>
          <tr>
            <td ng-repeat='day in days' width='20%'>{{day}}</td>
          </tr>
          <tr ng-repeat='x in [1,2,3,4]'>
            <td>
                <input placeholder='Enter Charge #' size='10'>
            </td>
            <td ng-repeat='t in [1,2,3,4,5,6,7]' width='10%'>
                <input type="number" size='3'>
            </td>
          </tr>
      </tbody>
    </table>
  </div>
 </div>

.

var optModule = angular.module('MyModule', []);

    function Controller($scope) {   
        $scope.days = ["", "MON", "TUE", "WED", 
            "THU", "FRI", "SAT", "SUN"];        
    }
4

1 回答 1

1

通过将输入宽度设置为 100%,将输入宽度设置为从其父级继承

<input style="width: 100%" type="number" size='3'>

http://jsfiddle.net/BnLEh/10/

HTML 表格中的文本框:如何自动调整大小?

于 2013-06-30T07:28:53.533 回答