Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何调整引导表中文本输入的宽度?_Html_Css_Twitter Bootstrap_Twitter Bootstrap 2 - Fatal编程技术网

Html 如何调整引导表中文本输入的宽度?

Html 如何调整引导表中文本输入的宽度?,html,css,twitter-bootstrap,twitter-bootstrap-2,Html,Css,Twitter Bootstrap,Twitter Bootstrap 2,我使用的是Bootstrap 2.3,在使用Bootstrap表样式的表中有7个文本输入字段。我想调整这些文本输入的大小(或缩小宽度),而不是占用表格单元格的整个宽度,但我不能这样做 我尝试使用span1类,但没有很好地缩小它们那么有没有办法最小化表格单元格中所有文本输入字段的大小或宽度? 这是我的密码: <table class="table table-bordered"> <thead> <

我使用的是Bootstrap 2.3,在使用Bootstrap表样式的表中有7个文本输入字段。我想调整这些文本输入的大小(或缩小宽度),而不是占用表格单元格的整个宽度,但我不能这样做

我尝试使用
span1
类,但没有很好地缩小它们那么有没有办法最小化表格单元格中所有文本输入字段的大小或宽度?

这是我的密码:

<table class="table table-bordered">
                <thead>
                    <tr>
                        <th>Exercise</th>
                        <th>Exercise Code</th>
                        <th>Initiated by</th>
                        <th>Initiated on</th>
                        <th>Done by</th>
                        <th>Q1</th>
                        <th>Q2</th>
                        <th>Q3</th>
                        <th>Q4</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            <input type="text" class="input-mini span1" />
                        </td>
                        <td>
                            For Action
                        </td>
                    </tr>
                </tbody>
            </table>

运动
作业守则
发起人
开始于
由
Q1
问题2
第三季度
第四季度
行动

既然您有权访问JQuery,请尝试在html的
区域中执行此操作,但请确保在所有Javascript都包含之后执行此操作

<script type="text/javascript">
  $(".span1").css("width", "10px");
</script>
唯一的负面影响是,这将更改所有使用.table类的table type=text元素

因此,让表本身具有span1标记,并更改上面的代码以反映它

.span1 > input[type="text"] {
    width: 10px;
}

*注意:请确保这是在您参考引导css之后进行的。

您可以发布一个链接到您的站点,以便我们可以看到不需要的行为吗?您似乎链接的不是2.3版本的引导。通过链接:
http://www.bootply.com/TRUEb0epAv
如果设置了bootstrap 2.3,则所有操作都正常。与此相反,如果要设置bootstrap 3.3,所有输入都将其宽度设置为单元格宽度的100%。不管怎样,您可以设置
.span1{width:50%!important}
,它应该可以正常工作。将
50%
更改为您希望的值,但不会使其最小化太多。@technology尽管我更新了答案,但我认为你需要给我们更多的代码或链接,这样我们就可以确切地看到你有什么了。
.span1 > input[type="text"] {
    width: 10px;
}