In the following example, when the width of the td containing the name is 60px, if there are fewer words in the second line, the display is normal, but if there are more words in the second line, the display is abnormal. Copy code The code is as follows:<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>123WORDPRESS.COM</title> <style type="text/css"> .mTable{width:200px;border:1px solid #666;border-collapse:collapse} .mTable td{border:1px solid #666} </style> </head> <body> <table width="200" cellspacing="0" cellpadding="0" class="mTable"> <tr> <td width="60">Name:</td> <td>Someone</td> </tr> <tr> <td colspan="2">Personal Profile</td> </tr> </table> <table width="200" cellspacing="0" cellpadding="0" class="mTable"> <tr> <td width="60">Name:</td> <td>Someone</td> </tr> <tr> <td colspan="2">Personal Profile Personal Profile Personal Profile</td> </tr> </table> </body> </html> Solution 1: (Also set the width of the second column td) Copy code The code is as follows:<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>123WORDPRESS.COM</title> <style type="text/css"> .mTable{width:200px;border:1px solid #666;border-collapse:collapse} .mTable td{border:1px solid #666} </style> </head> <body> <table width="200" cellspacing="0" cellpadding="0" class="mTable"> <tr> <td width="60">Name:</td> <td width="140">Someone</td> </tr> <tr> <td colspan="2">Personal Profile</td> </tr> </table> <table width="200" cellspacing="0" cellpadding="0" class="mTable"> <tr> <td width="60">Name:</td> <td width="140">Someone</td> </tr> <tr> <td colspan="2">Personal Profile Personal Profile Personal Profile</td> </tr> </table> </body> </html> Solution 2: (Set table-layout:fixed) Copy code The code is as follows:<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>123WORDPRESS.COM</title> <style type="text/css"> .mTable{width:200px;border:1px solid #666;border-collapse:collapse;table-layout:fixed} .mTable td{border:1px solid #666} </style> </head> <body> <table width="200" cellspacing="0" cellpadding="0" class="mTable"> <tr> <td width="60">Name:</td> <td>Someone</td> </tr> <tr> <td colspan="2">Personal Profile</td> </tr> </table> <table width="200" cellspacing="0" cellpadding="0" class="mTable"> <tr> <td width="60">Name:</td> <td>Someone</td> </tr> <tr> <td colspan="2">Personal Profile Personal Profile Personal Profile</td> </tr> </table> </body> </html> |
<<: Web design and production test questions and reference answers
>>: An example of how to write a big sun weather icon in pure CSS
By default, MySQL can accept the insertion of 0 v...
Location means "positioning", which is ...
This article example shares the specific code of ...
mysql permissions and indexes The highest user of...
Table of contents Preface Active withdrawal Excep...
Table of contents Overview 1. Application-level m...
Note 1: Solve the problem of slow connection to M...
1. Download 4 rpm packages mysql-community-client...
Table of contents Preface - Vue Routing 1. The mo...
Today, the company project needs to configure doc...
Preface The best method may not be the one you ca...
The default request header of the http1.1 protoco...
1. Connect to MYSQL Format: mysql -h host address...
Table of contents Preface Target first step: Step...
1. Introduction In the past, if you wanted to sta...