使用 css 在 div 中隐藏 div 元素
Hide div element inside div using css
我想隐藏 child div with id="checkbox-No recent experience_txh6181p" using css.
<div class="row">
<div class="grid-layout-col">
<div class="layout-col col-sm-12 col-xs-12">
<div id="formElement8" class="elq-field-style form-element-layout row">
<div style="text-align:left;" class="col-sm-12 col-xs-12"><label class="elq-label "
for="fe1729">skills</label></div>
<div class="col-sm-12 col-xs-12">
<div class="row">
<div class="col-xs-12">
<div class="field-control-wrapper" id="fe1729">
<div class="list-order one-column"><input type="checkbox"
id="checkbox-Used Java for school projects_hvba7ekg"
value="Used Java for school projects" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school
projects</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-0-1 years of professional experience_uwv0lzq"
value="0-1 years of professional experience" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional
experience</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-1-3 years of professional experience_jp55zebf"
value="1-3 years of professional experience" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional
experience</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-4+ years of professional experience_uey2b9qdk"
value="4+ years of professional experience" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional
experience</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-No recent experience_txh6181p" value="No recent experience"
name="checkboxes"><label class="checkbox-aligned elq-item-label"
for="checkbox-No recent experience_txh6181p">No recent experience</label><br></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
我想使用 id 或第 n 个 div CSS 隐藏选项“checkbox-No 最近 experience_txh6181p”。我该怎么做?
您的 ID 包含 space 在 html 中无效。
id's
value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. more info visit this
#checkbox-Norecentexperience_txh6181p{display:none;}// remove checkbox
#checkbox-Norecentexperience_txh6181p+label{display:none;} // to remove label
#checkbox-Norecentexperience_txh6181p{display:none;}
#checkbox-Norecentexperience_txh6181p+label{display:none;}
<div class="row">
<div class="grid-layout-col">
<div class="layout-col col-sm-12 col-xs-12">
<div id="formElement8" class="elq-field-style form-element-layout row">
<div style="text-align: left;" class="col-sm-12 col-xs-12"><label class="elq-label" for="fe1729">skills</label></div>
<div class="col-sm-12 col-xs-12">
<div class="row">
<div class="col-xs-12">
<div class="field-control-wrapper" id="fe1729">
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Used Java for school projects_hvba7ekg" value="Used Java for school projects" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school projects</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-0-1 years of professional experience_uwv0lzq" value="0-1 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-1-3 years of professional experience_jp55zebf" value="1-3 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-4+ years of professional experience_uey2b9qdk" value="4+ years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Norecentexperience_txh6181p" value="No recent experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Norecent experience_txh6181p">No recent experience</label><br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
或
你可以last-child
在css到hide.That是,
.list-order.one-column:last-child{display:none;}
.list-order.one-column:last-child{display:none;}
<div class="row">
<div class="grid-layout-col">
<div class="layout-col col-sm-12 col-xs-12">
<div id="formElement8" class="elq-field-style form-element-layout row">
<div style="text-align: left;" class="col-sm-12 col-xs-12"><label class="elq-label" for="fe1729">skills</label></div>
<div class="col-sm-12 col-xs-12">
<div class="row">
<div class="col-xs-12">
<div class="field-control-wrapper" id="fe1729">
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Used Java for school projects_hvba7ekg" value="Used Java for school projects" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school projects</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-0-1 years of professional experience_uwv0lzq" value="0-1 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-1-3 years of professional experience_jp55zebf" value="1-3 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-4+ years of professional experience_uey2b9qdk" value="4+ years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Norecentexperience_txh6181p" value="No recent experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Norecent experience_txh6181p">No recent experience</label><br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
使用 #experience_txh6181p{display:none;}
或 #experience_txh6181p{height:0px; overflow:hidden}
我想隐藏 child div with id="checkbox-No recent experience_txh6181p" using css.
<div class="row">
<div class="grid-layout-col">
<div class="layout-col col-sm-12 col-xs-12">
<div id="formElement8" class="elq-field-style form-element-layout row">
<div style="text-align:left;" class="col-sm-12 col-xs-12"><label class="elq-label "
for="fe1729">skills</label></div>
<div class="col-sm-12 col-xs-12">
<div class="row">
<div class="col-xs-12">
<div class="field-control-wrapper" id="fe1729">
<div class="list-order one-column"><input type="checkbox"
id="checkbox-Used Java for school projects_hvba7ekg"
value="Used Java for school projects" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school
projects</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-0-1 years of professional experience_uwv0lzq"
value="0-1 years of professional experience" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional
experience</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-1-3 years of professional experience_jp55zebf"
value="1-3 years of professional experience" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional
experience</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-4+ years of professional experience_uey2b9qdk"
value="4+ years of professional experience" name="checkboxes"><label
class="checkbox-aligned elq-item-label"
for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional
experience</label><br></div>
<div class="list-order one-column"><input type="checkbox"
id="checkbox-No recent experience_txh6181p" value="No recent experience"
name="checkboxes"><label class="checkbox-aligned elq-item-label"
for="checkbox-No recent experience_txh6181p">No recent experience</label><br></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
我想使用 id 或第 n 个 div CSS 隐藏选项“checkbox-No 最近 experience_txh6181p”。我该怎么做?
您的 ID 包含 space 在 html 中无效。
id's
value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. more info visit this
#checkbox-Norecentexperience_txh6181p{display:none;}// remove checkbox
#checkbox-Norecentexperience_txh6181p+label{display:none;} // to remove label
#checkbox-Norecentexperience_txh6181p{display:none;}
#checkbox-Norecentexperience_txh6181p+label{display:none;}
<div class="row">
<div class="grid-layout-col">
<div class="layout-col col-sm-12 col-xs-12">
<div id="formElement8" class="elq-field-style form-element-layout row">
<div style="text-align: left;" class="col-sm-12 col-xs-12"><label class="elq-label" for="fe1729">skills</label></div>
<div class="col-sm-12 col-xs-12">
<div class="row">
<div class="col-xs-12">
<div class="field-control-wrapper" id="fe1729">
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Used Java for school projects_hvba7ekg" value="Used Java for school projects" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school projects</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-0-1 years of professional experience_uwv0lzq" value="0-1 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-1-3 years of professional experience_jp55zebf" value="1-3 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-4+ years of professional experience_uey2b9qdk" value="4+ years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Norecentexperience_txh6181p" value="No recent experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Norecent experience_txh6181p">No recent experience</label><br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
或
你可以last-child
在css到hide.That是,
.list-order.one-column:last-child{display:none;}
.list-order.one-column:last-child{display:none;}
<div class="row">
<div class="grid-layout-col">
<div class="layout-col col-sm-12 col-xs-12">
<div id="formElement8" class="elq-field-style form-element-layout row">
<div style="text-align: left;" class="col-sm-12 col-xs-12"><label class="elq-label" for="fe1729">skills</label></div>
<div class="col-sm-12 col-xs-12">
<div class="row">
<div class="col-xs-12">
<div class="field-control-wrapper" id="fe1729">
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Used Java for school projects_hvba7ekg" value="Used Java for school projects" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school projects</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-0-1 years of professional experience_uwv0lzq" value="0-1 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-1-3 years of professional experience_jp55zebf" value="1-3 years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-4+ years of professional experience_uey2b9qdk" value="4+ years of professional experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional experience</label><br />
</div>
<div class="list-order one-column">
<input type="checkbox" id="checkbox-Norecentexperience_txh6181p" value="No recent experience" name="checkboxes" />
<label class="checkbox-aligned elq-item-label" for="checkbox-Norecent experience_txh6181p">No recent experience</label><br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
使用 #experience_txh6181p{display:none;}
或 #experience_txh6181p{height:0px; overflow:hidden}