tags:

views:

218

answers:

1

How does the Block component handle CSS classes? I have code like this:

<style type="text/css">
  .nameColumnHeader { width: 30%; }
  .nameColumnValue { width: 30%; vertical-align:top; }
</style>
...
<table>
  <tr>
    <th><span jwcid="nameColumnHeader@Block">...</span></th>
    <th><span jwcid="nameColumnValue@Block">...</span</th>
  </tr>
...
</table>

Ultimately, this seems to work. The styles seem to be applied even though the class attribute is not specified.

Why does this work? And wouldn't it be better form to specify the class attribute (in terms of maintainability)? At this point, however, this kind of code is all over the app, is it worth it to 'fix' it?

A: 

You're probably using the contrib:Table component - by default it applies classes to the and it generates (or perhaps in the , check the generated markup).

The value for those classes are generated from each column name, so for the 'phone' column they should be: phoneColumnHeader and phoneColumnValue... It just happens that you have a similarly named jwcid (nameColumnHeader) which added to the confusion.

Andreas Andreou