Capitalize only first word

  • thetechman
    Asked on January 18, 2018 at 6:18 AM

    Hello,

    it is possible via CSS to capitalize ONLY the first word of a sentence? If yes, could you provide the code, please?

    Thanks.

  • Dexter_R
    Replied on January 18, 2018 at 9:44 AM

    Yes, it's possible to capitalize word, but you need to set class for that word.

    You can try to capitalize first letter in the sentence, using pseudo element, something like this:

    .your_class_name::first-letter{

        text-transform: capitalize;

    }

    For example:

    Strawberry are red. I set the style, text-transform: capitalize, just for word strawberry.

    Or you can just capitalize the letter of the sentence.

    .your_class_name{

        text-transform: capitalize;

    }


    It will be great to provide us with the image and word you want to change and then we can resolve the issue together.

    I hope this hint helps, if not then please provide us with additional question. Thank you

  • thetechman
    Replied on January 18, 2018 at 10:04 AM

    Hi Dexter_R,

    if I understand in the right way, I have to change .your_class_name  with the field ID. That's correct?

  • Dexter_R
    Replied on January 18, 2018 at 10:35 AM

    Yes that's correct, see if that works for you.

    Let me know if this has helped.

  • thetechman
    Replied on January 18, 2018 at 10:45 AM

    I made some tests with the code below but with no success...

    .#input_32::first-letter {

        text-transform: capitalize;

    }

    But I forgot to specify that the word that has to be changed is located in a long text field that must be filled by users.

    I am afraid that this is the reason why the CSS code does not work.

    Any idea?

  • VictoriaKondratenko
    Replied on January 18, 2018 at 11:14 AM
  • David JotForm Support Manager
    Replied on January 18, 2018 at 12:25 PM

    I just checked your form, and it appears to work fine for the fields you have selected:

    1516296171test Screenshot 10

    Let us know if you need more help.

  • thetechman
    Replied on January 18, 2018 at 12:37 PM

    BDAVID,

    what happens if you write more than one word in those fields? I bet all words will be capitalized.

    But this is not what I need : only the first word must be capitalized. Only the first one.

    The field I want to manage is the first of the forth page with label "Rapporto tecnico / Technical report".

    I hope you can help me.

  • David JotForm Support Manager
    Replied on January 18, 2018 at 12:55 PM

    I have tried to find a workaround this, but all there is no Text Transform value to capitalize only the first letter of the first words.

    Text-Transform Values

    lowercase makes all of the letters in the selected text lowercase.

    uppercase makes all of the letters in the selected text uppercase.

    capitalize capitalizes the first letter of each word in the selected text.

    none leaves the text's case and capitalization exactly as it was entered.

  • thetechman
    Replied on January 18, 2018 at 12:59 PM

    OK, thanks anyway.