开发者

No text wrapping in HTML table on SharePoint

开发者 https://www.devze.com 2023-03-31 12:41 出处:网络
I have a table on SharePoint that I have constrained to a certain size. For this I have used table-layout:fixed; in my CSS. I then havetags in my html to size my columns as I would like.

I have a table on SharePoint that I have constrained to a certain size. For this I have used table-layout:fixed; in my CSS. I then have tags in my html to size my columns as I would like.

The problem is that when I use the tags the white-space: nowrap; in my CSS seems to be ignored. I even tried putting in the white-space attribute straight into my but to no avail.

Here i开发者_StackOverflow中文版s a sample of my code:

    #box-table-a
    {
 font-family:arial;
 border-collapse:collapse;
 font-size:8pt;
 border-style:solid;
 border-color:silver;
 border-width:1px;
 width:844;
 table-layout:fixed;
    }
    #box-table-a th
    {
 font-size:12px;
 font-weight:300;
 padding:2,2,2,2;
 color:#000000;
 border-style:solid;
 border-color:silver;
 border-width:1px;
 border-color:#000000;
 text-align:center;
 vertical-align:bottom;
 white-space: nowrap;
    }
    #box-table-a td
    {
 font-family:arial;
 font-size:12px;
 padding:2,2,2,2;
 color:#000000;
 border-style: solid;
 border-color:silver;
 border-width:1px;
 text-align:center;
 white-space: nowrap;

    }
    var TableHtml = "<table id='box-table-a'>";
    TableHtml +="<col width=100><col span=3 width=28><col width=100><TR><TH>Field1</TH><TH>Field2</TH><TH>Field3</TH><TH>Field4</TH><TH>Field5</TH></TR>";
    TableHtml +="<TR><TD>" + Field1[0] + "</TD><TD>" + Field2[0] + "</TD><TD>" + Field3[0] + "</TD><TD>" + Field4[0] + "</TD><TD>" + Field5[0] + "</TD></TR>";
    TableHtml +="</Table>";

Any help would be greatly appreciated!

Thanks, Karl


Try changing table-layout: fixed to table-layout: inherit if that doesn't work the way you want, maybe you might get lucky with table-layout: auto. Also be sure to include px in your dimensions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号