How to apply Title Case in input box through css

前端 未结 6 689
迷失自我
迷失自我 2020-12-16 01:23

I am using text-transform property to convert inputbox text into Title Case, But I am not getting the exact property or combination to do this.

I also tried

6条回答
  •  太阳男子
    2020-12-16 01:51

    Tips : Please check reset css style sheet for any override for text-transform

    text-transform property - Definition and Usage

    The text-transform property controls the capitalization of text.

    Default value: none

    Inherited: yes

    Version: CSS1

    JavaScript syntax: object.style.textTransform="uppercase"

    All browsers fully supports the property.

    CSS Syntax

    text-transform: none|capitalize|uppercase|lowercase|initial|inherit;
    // For DOM 
    document.getElementById("myP").style.textTransform = "capitalize";
    

    Property Values

    none - No capitalization. The text renders as it is. This is default

    capitalize - Transforms the first character of each word to uppercase

    uppercase - Transforms all characters to uppercase

    lowercase - Transforms all characters to lowercase

    initial - Sets this property to its default value.

    inherit - Inherits this property from its parent element.

    Test working file :

    https://jsfiddle.net/tfn2k46n/

提交回复
热议问题