NYCPHP Meetup

NYPHP.org

[nycphp-talk] Abstracting CSS: Reusable HTML UI Components

tedd tedd at sperling.com
Sun May 4 11:05:26 EDT 2008


At 9:57 PM -0400 5/3/08, Michael B Allen wrote:
>One possibility would be to allow the user to supply a class name that
>will be strategically set on some elements like:
>
>   <div class="myapp">
>   <table>
>   <tr><td colspan="2"><h3>Account Information</h3></td></tr>
>   <tr><td class="fieldlabel">Username:</td><td>abaker</td></tr>
>
>Then the user can supply their own CSS like:
>
>   div.myapp h3 {
>       color: #000080;
>       border-bottom: 2px #808080 solid;
>       margin-bottom: 0px;
>   }
>   div.myapp td.fieldlabel {
>       text-align: right;
>       white-space: nowrap;
>   }
>
>This seems a little clumsy to me but it's the best I can come up with.
>
>If you were given some HTML to be styled with CSS, how would you prefer
>the elements be organized?

Michael:

It's not clumsy to identify a table -- that part of separating 
content from presentation. It's just another variable to use.

However, if I were creating tables for different things, I might be 
more semantic and use ID's, such as id = "logInForm" rather than 
class="myapp" (whatever that means).

Cheers,

tedd


-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the talk mailing list