Text Color Based on DB Value

R

Ray Costanzo [MVP]

I'm not a "blame Microsoft for everything" kind of guy. They are absolutely
at fault for some things though. But I'm not speaking of that. I'm
speaking of what I don't like about strict CSS. I dislike IE for honoring
something like <span style="width: 200px;">, but at the same time, I curse
the W3C for not making that a standard. So, in this case, my frustration is
with CSS.

Ray at work
 
A

Adrienne

I agree that this isn't a great example, since you could certainly use
DIV elements instead of SPAN here:

<style type="text/css">
div.tabs div { width:200px; float:left; ... }
</style>

<div class="tabs">
<div>Tab 1</div>
<div>Tab 2</div>
<div>This is Tab #3</div>
</div>

I think a lot of people get unhappy with CSS because they are not using
semantic markup in the first place. That's how we wound up with tag soup
in the beginning, and now we have CSS soup instead.

If you use markup that pertains to the structure of a document, there
aren't that many places to go wrong. The example above looks like a list,
so I would use list markup and style the elements accordingly, eg:

ul {border:1px solid #000; list-style-type:none; padding:1em;}
ul li {width:200px; float:left; text-align:center; border-right:1px solid
#c0c0c0;}

<ul>
<li>Apples</li>
<li>Oranges</li>
<li style="border:0">Grapes</li>
</ul>

and you would come up with something like:
Apples | Oranges | Grapes

Of course my favorite use of CSS is to produce GreenBar tables where I have
a colora and colorb classes defined in an external stylesheet, and this
markup:
<% if counter mod 2 = 0 then
theclass = "colora"
else
theclass = "colorb"
end if
%>
<tr class="<%=theclass%>">
<td>data</td>
</tr>
<% 'continue loop and update counter %>

external sheet:
..colora {background-color:#fff; color:#000;}
..colorb {background-color:#f0fff0; color:#000;}

What's so great about that is consistency for the entire site. If I want
to change it to blue bar, I just need to change the colora and colorb
classes in the external sheet, and voila! the whole site is changed.
 
A

Adrienne

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per
message. Use of this email address implies consent to these terms.
Please do not contact me directly or ask me to contact you directly for
assistance. If your question is worth asking, it's worth posting.

Dave, I love that signature. Do you mind if I borrow it, and change it
slightly, maybe charge less, say $300?
 
B

Bob Lehmann

I'm not a "blame Microsoft for everything" kind of guy.
Few of us are. But, who else would you blame for IE being 5+ years old, and
severely out of touch?
Why should the W3C necessarily follow IE extensions/aberrations?
Myself, I'm upset with W3C for not making <blink> standard :>).

Bob Lehmann
 
R

Ray Costanzo [MVP]

Just make sure that you only go after the people who sent you the
unsolicited e-mail that you actually ~read~ though. :]

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top