NYCPHP Meetup

NYPHP.org

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

tedd tedd at sperling.com
Sun May 4 11:27:40 EDT 2008


At 11:10 AM -0400 5/4/08, Michael B Allen wrote:
>On Sun, May 4, 2008 at 10:28 AM, Daniel Convissor
>  >  On Sat, May 03, 2008 at 09:57:06PM -0400, Michael B Allen wrote:
>>   >
>>   >   <div class="myapp">
>>   >   <table>
>>   >   <tr><td colspan="2"><h3>Account Information</h3></td></tr>
>>   >   <tr><td class="fieldlabel">Username:</td><td>abaker</td></tr>
>  >  >
>  > > This seems a little clumsy to me but it's the best I can come up with.
>>
>>   This isn't clumsy.  It's exactly what CSS is for.  I'd put the class
>>   inside the table element, but that's me.
>
>At this point of uncertainty I've been in the habit of applying style
>through divs because they can quietly affect groups of any type of
>element without changing the css (e.g. in the above example, the div
>applies style to h3 regardless of whether or not it's in a table). If
>that style info turns out to be specific to tables of that type then
>yes, I agree that it should be on the table. In fact it is very likely
>that I will need table classes since tables are frequently used for a
>wide range of purposes including page layout, form structure and data
>display of different types.
>
>Mike


Mike:

Tables should not be used for anything except column data. Using 
tables for layouts is just bad practice and demonstrates a disregard 
for, or ignorance of, accessibility issues.

To style a h3 within a table without a class or id is easy enough by 
simply using

table h3	{style}

Or, don't use h3 at all and use the <th> tag -- after all, it's a 
heading, right? And, it's easy enough to style via

th [style]

Cheers,

tedd

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



More information about the talk mailing list