开发者

In CSS, a way to say, if the TD element has IMG in it, then "text-align: center"?

The line

td img { text-align: center }

won't work. It has to target the td instead: the td h开发者_JS百科aving an img element will have text-align: center. Can it be done in CSS 2.1?


Can you use jQuery? If you can then you can use a jquery selector to add a class to the td that will center it.

something like this untested code;

$('td img').parent().addclass('center');


Cannot be done without the help of JS or...

Add a class to the td:

<td class="img"><img .../></td>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜