固定的高度和宽度更改为标题(HTML表) [英] Fixed Height and Changing Width for Header (HTML Table)

查看:216
本文介绍了固定的高度和宽度更改为标题(HTML表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要确保该表的头的高度是固定的,宽度是根据在标题单元含量调整。 (标题文字是最大的两行显示的),我们怎样才能使用样式做什么呢?另外,我想确保表行的宽度是一样的标题行的宽度(即标题行决定宽度)。

注:在present,交易部门所有者别名进来线。它需要有两个行。

 <!DOCTYPE HTML PUBLIC -  // W3C // DTD XHTML 1.0过渡// ENhttp://www.w3.org/TR/xhtml1/DTD/ XHTML1-transitional.dtd>< HTML的xmlns =htt​​p://www.w3.org/1999/xhtml>< HEAD><标题>
< /标题><链接HREF =样式/ TestStyle.css的rel =stylesheet属性类型=文/ CSS/>< /头><身体GT;
< D​​IV ID =divForTransactionGrid>    < D​​IV>            <表CELLSPACING =0规则=所有边界=1ID =grdTransactions的风格=边界崩溃:崩溃;>                            <&THEAD GT;                                            &所述; TR>                                                            百分位范围=山口>事务ID< /第i个百分位范围=山口>事务名和LT; /第i个百分位范围=山口>事务所有者< /第i<日范围=山口>交易部所有者别名< /第i                                            < / TR>                            < / THEAD><&TBODY GT;                                            &所述; 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>这是一个测试值来测试的结果在实时场景。行宽度应相同头宽度LT; / TD>                                            < / TR>                            < / TBODY>            < /表> < / DIV>< / DIV>< /身体GT;< / HTML>

CSS

  #divForTransactionGrid{宽度:300像素;高度:250像素;溢出:滚动;}


解决方案

您最大的问题是打破。结果
交易部所有者别名结果
让每个空间,然而突破到一个新行,结果
交易&放大器; NBSP;&系功放; NBSP;拥有者放; NBSP;&别名放大器; NBSP;名称结果
将迫使句呆在一起,仿佛一个字。搜索结果
所有你需要做的就是离开你想让它打破一个常规的空间,使用和放大器; NBSP;的,你不希望它打破,你将有2个或更少的线。整整2线,使用换行符< BR>而不是打破空间。祝您好运。

I need to make sure that the height of the header of table is fixed and width is adjusted based on the header cell content. (Header text is displayed in maximum two rows) How can we do it using styles? Also, I want to make sure that the width of table rows is same as width of header row (i.e., header row determines width).

Note: At present, "Transaction Department Owner Alias Name" comes in lines. It need to come in two lines.

<!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>

CSS

#divForTransactionGrid 

{

width: 300px;

height: 250px;

overflow:scroll;

}

解决方案

You biggest issue is breaking.
Transaction Department Owner Alias Name
lets each space " " break to a new line, however
Transaction&nbsp;Department&nbsp;Owner&nbsp;Alias&nbsp;Name
will force the sentence to stay together as if a single word.

All you have to do is leave one regular space where you want it to break, and use &nbsp;'s where you don't want it to break and you will have 2 or less lines. for exactly 2 lines, use a line break <br> instead of a breaking space " ". Best of luck.

这篇关于固定的高度和宽度更改为标题(HTML表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆