One thing that has always puzzled me in existing HTML+CSS wysiwyg editors is the impossibility to create a table in a really strict markup context. I mean a table with no presentational attributes at all, no inline styles at all and only a class and/or ID or the table itself. Although almost nobody writes such tables, it's fairly simple for the most common attributes. I suspect it's for three reasons only : first, web sites use a lot of borderless tables ; second, existing editors don't let you do that ; third, most people don't understand CSS well enough. Let's suppose our table has ID mytable. Then we have the following equivalences:

  • for the border attribute on the <table> element if the value if not "0".
    #mytable {
    border: outset <value_of_the_attribute>px;
    }

    #mytable > * > tr > td,
    #mytable > * > tr > th {
    border: inset 1px;
    }
  • for the cellspacing attribute on the <table> element
    #mytable {
    border-spacing: <value_of_the_attribute>px;
    }
  • for the cellpadding attribute on the <table> element
    #mytable > * > tr > td,
    #mytable > * > tr > th {
    padding: <value_of_the_attribute>px;
    }
  • the rules and frame attributes on the table element is only a little bit more complex but it's a non-issue to map such an attribute to CSS rules.
  • the width, align and valign attributes on <table> and descendants of <table> are also a non-issue with a trivial mapping to their CSS counterparts
  • for the deprecated align attribute on <table>, a combination of 'margin-left: auto' and/or 'margin-right: auto'

In other terms, it's not a problem implementing an editor that provides a user wishing to insert a table with the following choice : "HTML attributes only", "Inline styles when possible", "Style rules or inline styles when possible". As a matter of fact, it's already implemented in BlueGriffon. Please don't focus on the UI since it's absolutely not final, it's even sure it's going to evolve a lot for instance to let the user reuse existing CSS style rules instead of creating new ones.

CSS policy