WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a table to a php page template.
The headers and cells contents show well, but the table attributes are being ignored.

This code:

<table border="1" cellspacing="10">  

produces the following result:

Name  Address

I get no border and no spacing (the headers are bolded, I just couldn't do it here).

Does it have something to do with wordpress?
How can it be solved?

share|improve this question
Wordpress removes some tags and attributes automatically yes, have you condidered styling your table with CSS ? – mike23 Jun 14 '11 at 9:18
i believe it has to do with your themes css overwriting it, can you see the attributes in the source? – Bainternet Jun 14 '11 at 9:19
@Bainternet, I'm currently using twenty ten. Where should I look for the attributes? – Ash Jun 14 '11 at 9:52
@mike23, no. So styling the table with css bypasses WP? – Ash Jun 14 '11 at 9:54
@Ash look in the source code of the page that is generated, right click -> view source – Bainternet Jun 14 '11 at 14:06
up vote 2 down vote accepted

Remove the border="1" attribute but leave the cellspacing. Then go into styles.css and either add your CSS selectors or modify the existing selectors. If your table is within the id="content" block, the styling is being affected by the existing selectors. The ones you will want to adjust are:

 #content table {
 border: 1px solid #e7e7e7;
 margin: 0 -1px 24px 0;
 text-align: left;
 width: 100%;
  #content tr th,
  #content thead th {
   color: #888;
   font-size: 12px;
   font-weight: bold;
   line-height: 18px;
   padding: 9px 24px;
   #content tr td {
    border-top: 1px solid #e7e7e7;
    padding: 6px 24px;
   #content tr.odd td {
    background: #f2f7fc;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.