Answers for "text capitalize"

CSS
74

css all caps

.uppercase {
  text-transform: uppercase;
}

#example {
  text-transform: none;	/* No capitalization, the text renders as it is (default) */
  text-transform: capitalize;	/* Transforms the first character of each word to uppercase */
  text-transform: uppercase;	/* Transforms all characters to uppercase */
  text-transform: lowercase;	/* Transforms all characters to lowercase */
  text-transform: initial;	/* Sets this property to its default value */
  text-transform: inherit;	/* Inherits this property from its parent element */
}
Posted by: Guest on June-10-2020
1

How do you make each word in a text start with a capital letter?

h1 {
  text-transform: capitalize;
}
Posted by: Guest on September-14-2020
2

css all uppercase to capitalize

.link {
  text-transform: lowercase;
 
}

.link::first-line {
  text-transform: capitalize;
}
Posted by: Guest on May-23-2020
-1

capitalize

function capitalize1(str) {
  const arrOfWords = str.split(" ");
  const arrOfWordsCased = [];

  for (let i = 0; i < arrOfWords.length; i++) {
    const word = arrOfWords[i];
    arrOfWordsCased.push(word[0].toUpperCase() + word.slice(1).toLowerCase());
  }

  return arrOfWordsCased.join(" ");
}
Posted by: Guest on August-17-2020

Browse Popular Code Answers by Language