将CSS生成的图像分配给表格中的单元格,具体取决于单元格的值 [英] Assign a CSS generated image to cells in a table depending on the value of the cell

查看:177
本文介绍了将CSS生成的图像分配给表格中的单元格,具体取决于单元格的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有css和html 在jsfiddle 。 CSS有点复杂(对我来说)。

I have the css and html here in jsfiddle. The CSS is a bit complicated (for me).

我使用没有特定ID的表。我得到他们的类名。

I'm working with tables that do not have specific IDs. I get them by getting their classname.

表中的行:

<tr class = "field_34">
  <th class = "kn-label">
    <span>Home</span>
  </th>
  <td class = "kn-value">
    <span>On</span>
  </td>
</tr>

我想将CSS生成的图像指定为On值。
这可以做吗?如何?

I would like to assign the CSS generated image to the "On" value. Can this be done? How?

Tim 333提供了解决方案。谢谢!证明如下:

Tim 333 gave the solution. Thank you! The proof is here:

http://jsfiddle.net/ VpvxR /

推荐答案

我有一种工作使用jquery替换一些div为你的css使用代码:

I kind of got it working using jquery to replace the On with some divs for your css using the code:

cssimage = '<div class="button-wrap">  <div class="button-out">On</div> <div class="button-switch"></div> </div>'

$('span:contains("On")').html(cssimage);

查看 http://jsfiddle.net/VpvxR/

这篇关于将CSS生成的图像分配给表格中的单元格,具体取决于单元格的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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