Sentence Case

Discussion in 'CSS' started by cancer10, Aug 23, 2007.

  1. #1
    How do I make a paragraph sentence Case (first alphabet of each word capital) in CSS?



    Thanx for your help.
     
    cancer10, Aug 23, 2007 IP
  2. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Use text-transform: capitalize.

    For example, if you want to capitalize the first letter in a h1 then use

    h1 {text-transform: capitalize;}

    or for a whole paragraph, use

    p {text-transform: capitalize;}

    Just give the paragraph a class name if you dont want it applied to all paragraphs.

    p.class_name {text-transform: capitalize;}

    and in your html you'd have something like this:

    <p class="class_name">your paragraph text</p>
     
    qazu, Aug 23, 2007 IP
  3. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But this does not work if the letters are already CAPITALIZED
     
    cancer10, Aug 23, 2007 IP
  4. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Ah, that's because it only capitalizes the first letter which is already capitalized. You actually want to get the other letters to lower case! I don't know if that's possible but maybe someone knows ...
     
    qazu, Aug 23, 2007 IP
  5. GWiz

    GWiz Peon

    Messages:
    359
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm very confused as what you want to accomplish. You state you want First letters capitalized, well the code gazu does exactly that. Then you state that they're already capitalized which makes absolutely no sense to me why you would need CSS to do something that's already been done for you.

    Please be more precise as in what you want.
     
    GWiz, Aug 24, 2007 IP