csshidedisplaytag

Hide div element inside div using css


I want to hide 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>

I want to hide the option "checkbox-No recent experience_txh6181p" using id or using the nth div CSS. How can I do this?


Solution

  • Your ID contains space it is not valid in 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>

    OR

    You can you last-child in css to hide.That is,

    .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>