React in table form to set the border attribute border = "1" is invalid? ? ?

Some small partners might have tried the following lines, set the border in the form rendering React

 

After setting found to be invalid? ? ?

 

the reason:

In fact, seriously speaking border properties of these table are also no longer in the HTML5 standard. React This is not a problem, but it comply with the HTML5 specification only. 
So after React use in CSS manner frame, as shown below
普通写法:
<table border="2" cellpadding="5" cellspacing="0" width="40%"> <tr><td> aaa </td><td> bbb </td></tr> <tr><td> ccc </td><td> ddd </td></tr> </table>
React写法: <table class="mytable"> <tr><td> aaa </td><td> bbb </td></tr> <tr><td> ccc </td><td> ddd </td></tr> </table>​

CSS style settings are as follows:

        table.mytable {
            width: 40%;
            border: 2px solid #444;  
            border-spacing: 0;    
        }
        table.mytable tr,table.mytable th {border-bottom: 1px solid #444}
        table.mytable td,table.mytable th{
            border-right: 1px solid #444;
            border-bottom: 1px solid #444;
            padding: 5px;
        }
        table.mytable tr td:last-child{ border-right: 0 }
        table.mytable tr:last-child td{ border-bottom: 0 }

 

 

 

 

 

 

.

Guess you like

Origin www.cnblogs.com/jianxian/p/12360437.html