English 中文(简体)
CSS超标的超高超湿度财产
原标题:Overwrite HTML width property with CSS

能否在CSS中不使用CSS等级的表上的超文本财产权?

我尝试过这样的事情,没有幸运:

<table cellpadding="0" cellspacing="0" width="180">
    <tbody>
        <tr>
            <td bgcolor="#f0f0f0">
                <img style="display:block;" border="0" src="menu_up.jpg" alt=" " width="20" height="64">
            </td>
         </tr>
    </tbody>
</table>

CSS:

@media only screen and (max-device-width: 480px) {

    td[width=180] {
        width: 100px !important;
    }

}

任何想法?

帮助非常受赞赏。

最佳回答

是的,这是可能的。 您仅需要选择<代码>table,而不是td,而且你应在报价中说明血缘特性的价值(对此作了解释)。

table[width="180"] {
    width: 100px !important;
}
问题回答
  1. The value in a CSS attribute selector has to be quoted.
  2. Use table instead of td.

The following work asget in 9.0.1 (http://jsfiddle.net/WsbP6/).

table[width="180"] {
    width: 1000px;
}

不用引述,我奥列里出现以下错误:

Expected identifier or string for value in attribute selector but found 180 .
Ruleset ignored due to bad selector.

我认为,你可以把错事作为攻击目标,而不是 t(1},尝试表{}:

rel=“nofollow>http://jsfiddle.net/adaz/msgtG/





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!