Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.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
Javascript 标题的固定高度和更改宽度(HTML表格)_Javascript_Jquery_Asp.net_Html_Css - Fatal编程技术网

Javascript 标题的固定高度和更改宽度(HTML表格)

Javascript 标题的固定高度和更改宽度(HTML表格),javascript,jquery,asp.net,html,css,Javascript,Jquery,Asp.net,Html,Css,我需要确保表格标题的高度是固定的,宽度是根据标题单元格内容调整的。(标题文本最多显示两行)如何使用样式?此外,我希望确保表行的宽度与标题行的宽度相同(即,标题行决定宽度) 注:目前,“交易部门所有者别名”为行。它需要分成两行 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html

我需要确保表格标题的高度是固定的,宽度是根据标题单元格内容调整的。(标题文本最多显示两行)如何使用样式?此外,我希望确保表行的宽度与标题行的宽度相同(即,标题行决定宽度)

注:目前,“交易部门所有者别名”为行。它需要分成两行

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>


</title><link href="Styles/TestStyle.css" rel="stylesheet" type="text/css" /></head>



<body>


<div id = "divForTransactionGrid">

    <div>

            <table cellspacing="0" rules="all" border="1" id="grdTransactions" style="border-collapse:collapse;">

                            <thead>

                                            <tr>

                                                            <th scope="col">Transaction ID</th><th scope="col">Transaction Name</th><th scope="col">Transaction Owner</th><th scope="col">Transaction Department Owner Alias Name</th>

                                            </tr>

                            </thead><tbody>

                                            <tr>

                                                            <td>1</td><td>TR1</td><td>Lijo</td><td>Lijo</td>

                                            </tr><tr>

                                                            <td>2</td><td>TR2</td><td>Lijo</td><td>This is a test value to test the result in real time scenario. Row width should be same as header width</td>

                                            </tr>

                            </tbody>

            </table>

 </div>

</div>





</body>

</html>


你最大的问题是打破僵局。
交易部门所有者别名

但是,允许每个空格“”换行到新行
交易部门所有者别名

将迫使句子像单个单词一样保持在一起。


你所要做的就是在你想让它断开的地方留下一个固定的空间,在你不想让它断开的地方使用它,你将有2行或更少的行。对于正好两行,请使用换行符
而不是换行空格“”。祝你好运。

你能花点时间修改一下问题空间吗?
#divForTransactionGrid 

{

width: 300px;

height: 250px;

overflow:scroll;

}