基于标签内容的样式 [英] style based on tag content

查看:61
本文介绍了基于标签内容的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想基于

内容更改表格数据字段中的文字颜色...


例如,我''喜欢所有< td> pos< / td>显示pos红色的。所有

< td>待定< / td>应该显示为正常的黑色。我真的不想要
来增加课程或风格,但这就是我一直在做的事情

远... 。


我似乎记得这是可能的,我现在不记得

语法,我没有运气与谷歌...


提前致谢,

Jeff P.

I''d like to change the color of text in a table data field based on the
content...

For example, I''d like all <td>pos</td> to show the "pos" in red. All
<td>pending</td> should show as the normal black. I don''t really want
to have to add a class or a style, but that''s how I''ve been doing it so
far...

I seem to remember that this is possible, I just can''t remember the
syntax right now and I''m not having any luck with google...

Thanks in advance,

Jeff P.

推荐答案

2006年4月27日11:17:13 -0700, jp **** **@rgs.uci.edu 写道:
On 27 Apr 2006 11:17:13 -0700, jp******@rgs.uci.edu wrote:
我想基于
内容更改表格数据字段中的文字颜色...

例如,我想要所有< td> pos< / td>显示pos红色的。所有待定< / td>应该显示为正常的黑色。我真的不想要增加一个班级或一个风格,但这就是我一直在做的事情
远......
我似乎记得这是可能的,我现在不记得
语法,而且我对谷歌没有任何好运......
I''d like to change the color of text in a table data field based on the
content...

For example, I''d like all <td>pos</td> to show the "pos" in red. All
<td>pending</td> should show as the normal black. I don''t really want
to have to add a class or a style, but that''s how I''ve been doing it so
far...

I seem to remember that this is possible, I just can''t remember the
syntax right now and I''m not having any luck with google...



当您处理数据以将其放入表中时,请检查它是什么,b $ b是什么,然后给< td>适当的类。


例如在php:



As you process the data to put it in the table, check to see what it
is and then give the <td> the appropriate class.

For example in php:


myClass ="" ;;

if(
myClass="";
if (


row-> status ==" pos")
row->status == "pos")


这篇关于基于标签内容的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆