Home >CMS Tutorial >WordPress >How to insert a table in wordpress without plugins
How to insert a table in wordpress without plug-in?
WordPress is very powerful, but its editor is very simple. Maybe WordPress has simplified the background editor because of its rich plug-in functions. Of course, the WordPress editor is fully capable of inputting some simple text and images, but if you want to input slightly more complex formats like tables, you have to surrender to WordPress. Although there is a "Paste from Word" function key in the WordPress editor, the table copied from Word and pasted in WordPress will disappear, even if the table code edited in Dreamweaver is pasted into the WordPress editor It still cannot be rendered perfectly in HTML format.
Recommended: "wordpress tutorial"
It is not difficult to insert a table in WordPress. You can easily use the wp-table plug-in We can do it, but if we use plug-ins to solve problems as soon as we encounter them, WordPress will be brought down sooner or later. Let me reiterate my slogan again: If you can do it with code, never use plug-ins! Therefore, this article does not make any comments on the wp-table plug-in. Friends in need can try it. The focus of this article is to introduce the method of inserting tables in WordPress without plug-ins.
Getting to the point, just like using the caption attribute to add a description border to an image, to insert a table in WordPress, we only need to define a CSS style for the table. The reference code is as follows:
The code is as follows:
/*----------table----------*/ table.table { border-spacing:2px; border-collapse:separate; background-color:#FFF; border-color:gray; border-style:outset; border-width:1px; } table.table th { background-color:#FFF; -moz-border-radius:0; border-color:gray; border-style:inset; border-width:1px; padding:1px; } table.table td { -moz-border-radius:0; border-color:gray; border-style:inset; border-width:1px; padding:1px; }
When inserting a table in the WordPress backend editor, just use an editor like Dreamweaver to draw the table in advance, and then paste the code into HTML format, and quote class="table", for example:
The code is as follows:
<table class="table" border="1" width="200" align="center"> <tbody> <tr> <td>第1行第1列</td> <td>第1行第2列</td> </tr> <tr> <td>第2行第1列</td> <td>第2行第2列</td> </tr> </tbody> </table>
Effect:
Row 1, Column 1, Row 1, Column 2
Row 2 Column 1 Row 2 Column 2
The above is the detailed content of How to insert a table in wordpress without plugins. For more information, please follow other related articles on the PHP Chinese website!