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

  • Home
  • SEARCH
  • 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 6874589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:12:49+00:00 2026-05-27T04:12:49+00:00

Using the following code, I am unable to capitalise a label that directly follows

  • 0

Using the following code, I am unable to capitalise a label that directly follows a file input field in chrome:

CSS

label {
    text-transform: capitalize;    
}

HTML

<label for="book-file">file</label>
<input type="file" name="a_file" id="a_file"><label for="a_file">required</label>

Error reproduced:

JSFiddle : http://jsfiddle.net/Nc27q/

A way to resolve this is to move the second label onto its own line (see: http://jsfiddle.net/Nc27q/1/ ) within the HTML or even placing a space in between the HTML tags.

The second label is added using Javascript (as an error message) which is why it is not placed on another line.

Does anybody know why chrome does this and how I can get around it in a CSS only way?

  • 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-05-27T04:12:50+00:00Added an answer on May 27, 2026 at 4:12 am

    It does indeed look like a bug. It’s like it’s seeing the file input in front of the text and treating that as part of the word, so not seeing the “r” in “required” as the first character in need of capitalization.

    Adding

    label:before {
        content: " ";
    }
    

    to force the space seems to work: http://jsfiddle.net/Nc27q/4/ Since this is a Chrome-specific issue, you don’t have to worry about pseudo-elements not being supported… (Of course, you may want to target it a bit more tightly than I have above.)

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

Sidebar

Related Questions

Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using following code to remove some specific nodes from xml file..It show
Good morning, I am using the following code so that my app shows up
When using the following code (simplified), I get the error Unable to cast the
Using the following code to make my requests, what i've noticed is that data
I am trying to remove a file from path using following code. But my
I am using following code to handle all the unhandled exceptions in the program.
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I am using following code to check whether a check box on my website

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.