How to hide element label by element id in CSS?

2019-02-06 05:50发布

Let's say I've got this code

<table>
    <tr>
        <td><input id="foo" type="text"></td>
        <td><label for="foo">This is foo</label></td>
    </tr>
</table>

This will hide the input:

#foo { display: none;}  /* or hidden could work too, i guesss */

How do I hide the label?

标签: css input label
8条回答
孤傲高冷的网名
2楼-- · 2019-02-06 06:52

You have to give a separate id to the label too.

<label for="foo" id="foo_label">text</label>

#foo_label {display: none;}

Or hide the whole row

<tr id="foo_row">/***/</tr>

#foo_row {display: none;}
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-02-06 06:52

This is worked for me.

#_account_id{
        display: none;
    }
    label[for="_account_id"] { display: none !important; }
查看更多
登录 后发表回答