CSS controls the TD width of table

Source: Internet
Author: User

Today found that even if the TD, th width set table, is still used, is based on the table's TD content to adapt to the width, resulting in other th, TD lost.

    • is the browser-rendered table that causes the missing port column because the TD content in device name is too long. Code:

<Tablewidth= "100%"Border= "0"cellspacing= "0"cellpadding= "0"class= "Table1"ID= "Dvrequipnet">       <TR>           <thScope= "Col" width= "15%"> Device ID</th>           <thScope= "Col" width= "15%"> Management Server ID</th>           <thScope= "Col" width= "15%"> Device Name</th>           <thScope= "Col" width= "15%"> Ports</th>        </TR>        <ScriptID= "Test"type= "text/html">{Each data as value I}}<TR class="_acctr">                <TD>{{value.id}}</td>                <TD>{{Value.sid}}</td>                <TD>{{Value.name}}</td>                <TD>{{value.subaddr}}</td>            </tr>            {{/Each }}        </Script> </Table>

    • Properties of CSS beyond Hiding (overflow:hidden;), forcing the display on the same line (white-space:nowrap;), ellipsis (text-overflow:ellipsis;), the light has these is not possible, To set the maximum width of the TD (Max-width:30px), and add Tilte properties, you can see the hidden contents of the mouse when it is placed.

{    overflow:hidden;      white-space:nowrap;      text-overflow:ellipsis;     max-width: 30px;}

{Each data as value I}}<TRclass= "_acctr">           <TD>{{Value.id}}</TD>           <TD>{{Value.sid}}</TD>            <TDtitle= "{{value.name}}">{{Value.name}}</TD>           <TD>{{VALUE.SUBADDR}}</TD>       </TR>
{{/each}}

CSS controls the TD width of table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.