2017-02-25 28 views
0

我想隱藏一個使用CSS的字段集。還有其他的字段集使用相同的CSS類,我不想隱藏它們。如何隱藏使用CSS的字段集

這就是特定的字段集的樣子;

<fieldset class="span6"> 
       <legend>Search by User Name</legend> 
       <label> 
        User Name: 
        <input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text"> 
       </label> 

       <label> 
        Exact Name: 
        <input name="exactname" value="1" type="checkbox"> 
       </label> 
</fieldset> 
+1

你是否允許修改HTML? –

回答

0

給該字段集標識並隱藏它。

一個獨特的ID將它與具有相同類別的其他元素區分開來。

#unique { 
 
display:none; 
 
}
<fieldset id="unique" class="span6"> 
 
       <legend>Search by User Name</legend> 
 
       <label> 
 
        User Name: 
 
        <input id="kusersearch" data-provide="typeahead" 
 
       name="searchuser" autocomplete="off" value="" type="text"> 
 
       </label> 
 

 
       <label> 
 
        Exact Name: 
 
        <input name="exactname" value="1" type="checkbox"> 
 
       </label> 
 
       </fieldset>

檢查片段其隱藏。希望這可以幫助!

1

你可能用nth-child選擇,因爲它包括same class下面所有的字段集,

.span6:nth-child(3){ 
 
    border:none; 
 
    background:#ccc; 
 
}
<fieldset class="span6"> 
 
       <legend>Search by User Name</legend> 
 
       <label> 
 
        User Name: 
 
        <input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text"> 
 
       </label> 
 

 
       <label> 
 
        Exact Name: 
 
        <input name="exactname" value="1" type="checkbox"> 
 
       </label> 
 
</fieldset> 
 

 
<fieldset class="span6"> 
 
       <legend>Search by User Name</legend> 
 
       <label> 
 
        User Name: 
 
        <input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text"> 
 
       </label> 
 

 
       <label> 
 
        Exact Name: 
 
        <input name="exactname" value="1" type="checkbox"> 
 
       </label> 
 
</fieldset> 
 

 

 
<fieldset class="span6"> 
 
       <legend>Search by User Name</legend> 
 
       <label> 
 
        User Name: 
 
        <input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text"> 
 
       </label> 
 

 
       <label> 
 
        Exact Name: 
 
        <input name="exactname" value="1" type="checkbox"> 
 
       </label> 
 
</fieldset> 
 

 

 
<fieldset class="span6"> 
 
       <legend>Search by User Name</legend> 
 
       <label> 
 
        User Name: 
 
        <input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text"> 
 
       </label> 
 

 
       <label> 
 
        Exact Name: 
 
        <input name="exactname" value="1" type="checkbox"> 
 
       </label> 
 
</fieldset>

0

試試這個!只需使用隱藏屬性與所需輸入

<fieldset class="span6"> 
 
    <legend>Search by User Name</legend> 
 
    <label> 
 
        User Name: 
 
        <input id="kusersearch" data-provide="typeahead" name="searchuser" autocomplete="off" value="" type="text" hidden> 
 
       </label> 
 

 
    <label> 
 
        Exact Name: 
 
        <input name="exactname" value="1" type="checkbox"> 
 
       </label> 
 
</fieldset>