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?

  • Wordpress removes some tags and attributes automatically yes, have you condidered styling your table with CSS ?
    – mike23
    Jun 14, 2011 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, 2011 at 9:19
  • @Bainternet, I'm currently using twenty ten. Where should I look for the attributes?
    – Ash
    Jun 14, 2011 at 9:52
  • @mike23, no. So styling the table with css bypasses WP?
    – Ash
    Jun 14, 2011 at 9:54
  • @Ash look in the source code of the page that is generated, right click -> view source
    – Bainternet
    Jun 14, 2011 at 14:06

1 Answer 1


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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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