In the process of creating a web page, the method of creating a fine border is indispensable. Here we will introduce two common methods for creating table borders, all of which have passed XHTML verification.
<! 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> <meta http-equiv =" Content-Type "content =" text/html; charset = UTF-8 "/> <title> two CSS implementation methods for table border </title> <style type =" text/css ">/* use table style border-collapse: collapse implements fine border */. tab1 {width: 300px; height: 200px; border: 1px solid # ccc; border-collapse: collapse ;}. tab1 td ,. tab1 th {border: 1px solid # ccc; padding: 5px;}/* use the table style border-spacing: 0px; and use different background colors of the table and cell to implement a fine border. IE7 and earlier browsers do not support the border-spacing attribute, which can be replaced by the cellspacing attribute of table. */. Tab2 {width: 300px; height: 200px; background-color: # ccc; border-spacing: 1px ;}. tab2 td ,. tab2 th {background-color: # fff ;}</style>