[Web/Easyui]table里的列宽怎么设置都不正确?

作者在调整EasyUI tabs组件时遇到宽度问题,发现内部input元素的100%宽度导致布局异常。通过将宽度改为95%,解决了组件的拥挤问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

试了老半天,发现怎么设置,他要不没反应,要不就是他width他自己的,跟自己设置的width一点都不一样,郁闷坏了,什么鬼情况?左边怎么这么挤啊?

<div id="tt" class="easyui-tabs" style="width: 100%;height: 100%">
    <div title="sj">
        <form method="post" id="editForm" name="editForm" fit="true">
            <input type="hidden" name="others" id="others"/>
            <table class="tableForm tableCss">
                <colgroup>
                    <col style="width: 185px" />
                    <col style="width: 175px;" />
                    <col style="width: 135px" />
                    <col style="width: 175px;" />
                    <col style="width: 115px" />
                    <col style="" />
                </colgroup>
                <tr>
                    <th style="">课程:</th>
                    <td colspan="5">
                        <input class="easyui-combobox" style="width: 100%" id="add_course_id" name="po.course_id" value="${(po.course_id!)!}">
                    </td>
                </tr>
                <tr>
                    <th style="">知识点:</th>
                    <td style="">
                        <input class="easyui-combobox" style="width: 100%" id="add_knowledge_points" name="po.knowledge_points" value="${(po.knowledge_points!)!}">
                    </td>
                    <th style="">试卷名:</th>
                    <td style="">
                        <input class="easyui-textbox" style="width: 100%" name="po.topic" value="${(po.topic!)!}" id="topic_e">
                    </td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <th style="">类型:</th>
                    <td style="">
                        <input class="easyui-combobox" style="width: 100%" id="type" name="po.type" value="${(po.type!)!}">
                    </td>
                    <th style="">难易度:</th>
                    <td style="">
                        <input class="easyui-combobox" style="width: 100%" name="po.difficulty_level" value="${(po.difficulty_level!)!}">
                    </td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <th style="">单选题数量:</th>
                    <td style="">
                        <input class="easyui-numberbox" style="width: 100%" type="text" name="po.single_selection" value="${(po.single_selection!)!}" data-options="required:true">
                    </td>
                    <th style="">单选题分数:</th>
                    <td style="">
                        <input class="easyui-numberbox" style="width: 100%" type="text" id="single_fraction" name="po.single_fraction" value="${(po.single_fraction!)!}" data-options="min:0,precision:2,required:true">
                    </td>
                    <th style="">单选题总分数:</th>
                    <td style="">
                        <input class="easyui-textbox" style="width: 100%" type="text" id="single_total_fraction" data-options="">
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>

一开始都想着是不是列宽没设置好,左改右改,没用,然后看到了内部input的宽度100%,是不是这个?

遂将其所有内部input的宽度改成了95%,发现可以了,正常了。吐血

<%@ page language="java" contentType="text/html; charset=UTF-8" import="dao.*,model.*,java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>员工基本信息</title> <!-- 引入本地 EasyUI 的 CSS 和 JS(假设项目根目录下有 easyui 文件夹) --> <link rel="stylesheet" type="text/css" href="../easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../easyui/themes/icon.css"> <script type="text/javascript" src="../easyui/jquery.min.js"></script> <script type="text/javascript" src="../easyui/jquery.easyui.min.js"></script> </head> <body> <% Userdao mydao = new Userdao(); List<Users> userlist = mydao.QueryUserInfoAll(); %> <h1 align="center">员工基本信息</h1> <!-- 使用 EasyUI 的 datagrid 组件 --> <!-- 外层添加一个 div 容器,并设置居中样式 --> <div style="width: 100%; text-align: center;"> <table class="easyui-datagrid" style="width:600px; height:auto; margin: 0 auto;" data-options="singleSelect:true, collapsible:true, url:'', method:'get'"> <thead> <tr> <th data-options="field:'user_id', width:100, align:'center'">用户名</th> <th data-options="field:'user_pwd', width:100, align:'center'">密码</th> </tr> </thead> <tbody> <% Users myUsers = new Users(); for (int i = 0; i < userlist.size(); i++) { myUsers = userlist.get(i); String user_id = myUsers.getuser_id(); String user_pwd = myUsers.getuser_pwd(); %> <tr> <td><%=user_id%></td> <td><%=user_pwd%></td> </tr> <% } %> </tbody> </table> </div> </body> </html>
最新发布
07-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值