The width of the <table> cell is self-adapting to the size of the content, and the place is squeezed together without content. You need to fix the table width and the width of each column.
Table-layout:fixed
In a fixed table layout, the horizontal layout depends only on the table width, column width, table border width, cell spacing, and the contents of the cell.
White-space:nowrap; Text-overflow:ellipsis; Overflow:hidden;
Text that exceeds the specified length is displayed as an ellipsis.
1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>Test</title>6 <style>7 * {8 padding:0;9 margin:0;Ten } One Table{ A width:300px; - Table-layout:fixed; - } the . First_col{ - White-space:nowrap;Text-overflow:ellipsis;Overflow:Hidden; - width:150px; - } + . First_col_text{ - White-space:nowrap;Text-overflow:ellipsis;Overflow:Hidden; + Color:Red; A width:120px; at float: Left; - - } - img{ - width:20px; - Height:20px; in float: Right; - Margin-right:5px; to } + . Second_col{ - White-space:nowrap;Text-overflow:ellipsis;Overflow:Hidden; the width:100px; * } $ . Third_col{Panax Notoginseng White-space:nowrap;Text-overflow:ellipsis;Overflow:Hidden; - width:50px; the } + </style> A </Head> the <Body> + <TableBorder= "1"cellspacing= "0"cellpadding= "0"> - <TR> $ <TDclass= "First_col"> $ <Divclass= "First_col_text">123456789012345</Div> - <imgsrc= "http://tb2.bdstatic.com/tb/editor/images/face/i_f23.png?t=20131111"> - </TD> the <TDclass= "Second_col">12345678901234567890123456789012345678901234567890</TD> - <TDclass= "Third_col">1</TD>Wuyi </TR> the <TR> - <TDclass= "First_col"></TD> Wu <TDclass= "Second_col"></TD> - <TDclass= "Third_col">12345678901234567890123456789012345678901234567890123456789012345678901234567890</TD> About </TR> $ <TR> - <TDclass= "First_col">123456789012345</TD> - <TDclass= "Second_col"></TD> - <TDclass= "Third_col"></TD> A </TR> + </Table> the </Body> - </HTML>
Display effect:
CSS implementation table fixed width, more than the contents of the cell omitted