Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:30:31+00:00 2026-06-14T13:30:31+00:00

I have this HTML code : <div class=field> <input type=hidden value= name=a id=a> <input

  • 0

I have this HTML code :

<div class="field">                  
<input type="hidden" value="" name="a" id="a"> <input type="hidden" value="xxxx" name="b" id="b">
<input type="file" value="" name="file1"> <input type="file" value="" name="file2">
<input type="file" value="" name="file3"> <input type="file" value="" name="file4">
<input type="file" value="" name="file5"> <input type="file" value="" name="file6">
<input type="file" value="" name="file7"> <input type="file" value="" name="file8">     </div>

In this HTML, i want hide all input type=”file” inside div class=”field”except the first one.
I cannot change the HTML (adding classes).
I tried to apply a pseudoclasses and structurate selector toghether, to accomplish the task :

.field input[type='file']{
  display:none;
}

.field input[type='file']::first-child{
display:block;
}

But it seems doesn’t work.
Anyone could suggest me the right syntax for using pseudo classes and selector togheter in css, to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:30:32+00:00Added an answer on June 14, 2026 at 1:30 pm

    Pseudo-classes use only one colon, so it’s :first-child, not ::first-child.

    But your first input[type='file'] is not the first child, so you can’t use :first-child with it anyway.

    You have to switch the rules around and use a sibling selector instead to hide the subsequent file upload inputs:

    .field input[type='file'] {
        display:block;
    }
    
    .field input[type='file'] ~ input[type='file'] {
        display:none;
    }
    

    This technique is further described here, and can be used for most other simple selectors, not just classes and attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple piece of HTML code: <div> <input type=file name=english-file /> </div>
I have this html; <div class=AttachmentContainer> <div class=display-label>Attachment name</div> <div class=display-field> <input type=checkbox id=chkAttachment
I have the following html code like this: <div class="question"> <input class="cross-reference-question-value-id" id="enr_rds_question_ids" name="enr_rds_surv_rdsap_xref[enr_rds_question_id]"
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
Hi i have this html code which shows an input field: <div data-role=content data-theme=a>
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I have this HTML code: <div id=main> <div id=dv_7>...</div> <div id=dv_1>...</div> <div id=dv_8>...</div> <div
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.