Results 1 to 10 of 10

Thread: css first-letter uppercase not working if the rest is lowercase

  1. #1
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default css first-letter uppercase not working if the rest is lowercase

    Hi everyone,

    I encountered a slight problem but quite boring...

    i have a text that i want all lowercase whatever the user puts in.. so i use at display
    .contenuNews {
    font-weight: bold;
    font-size: 48px;
    color: #D53B00;
    text-align: left;
    width: 500px;
    text-transform: lowercase;

    }


    And i want the first letter to be uppercase so i thought i could use

    .contenuNews:first-letter {
    text-transform: uppercase;
    }


    But nothing appears going uppercase unless i remove the lower case of the Contenunews tag.

    Could someone tell me how to bypass this problem or tell me if i made a error?

    Thanks a lot.

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there noobster,

    the code works OK for me using Firefox 2, Opera 9 and IE 7.

    coothead

  3. #3
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well that's bizarre...maybe i don't declare them well...i'll try again then.

    thanks for your feedback

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    chances are he is testing it in IE6, which doesnt support the css3.0
    I believe that IE6 supports CSS1 almost completely, while it has very limited support for CSS2, and even less if any of CSS3.

    I believe you are going to need some javascript to implement this, to have it standard on all browsers, unless you do not mind everything being in lowercase.

  5. #5
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well i wanted to have the first character of the first line at least, uppercase to have little control over visual aspect.


    I have to do some further testing but in fact i was using IE7.

    If the solution doens't seem obvious to any of you (nor to me ) i guess i just have to start over and do a step by step to see what's wrong in my code.

    thanks

  6. #6
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there noobster,

    this is the code that I tested successfully...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>text-transform:uppercase test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <style type="text/css">
    .contenuNews {
        font-weight:bold;
        font-size:48px;
        color:#D53B00;
        text-align:left;
        width:500px;
        text-transform:lowercase;
     }
    .contenuNews:first-letter {
        text-transform:uppercase;
     }
    </style>
    
    </head>
    <body>
    
    <div class="contenuNews">tHIS IS A TEST</div>
    
    </body>
    </html>
    See if it works for you.

    coothead

  7. #7
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    that won't work in anything below IE7 as only the achor (:link, :visited, :hover, :active) pseudo selectors are supported.

    this is CSS3, and I believe that CSS2 isn't even fully supported by most browsers, so the affect of this will never be universal, however the text will still be transformed to lowercase, as that selector is CSS1, which is widely supported

  8. #8
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @Boogeyman

    Well in fact this is to be used on one single machine using IE7 so compatibility isn't really a problem right now...but thanks for the info (i ll keep it in mind , i know how clear css is difficult to obtain

    @ coothead : thanks for the tip i try that today and check back later, i use a external css file but i guess if one selector works, why won't another... I 'll send feedback as soon as i can..thanks again

  9. #9
    Join Date
    Mar 2007
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This works for me in all browsers I have tested (IE6, IE7, FF, Opera, Netscape..)
    Code:
    p.blogtitle:first-letter {
    	font-size: x-large;
    	font-weight: bold;
    	float: left;
    	}
    
    p.blogtitle { 
    	font-size: 10pt;
    	font-style: italic;
    	word-spacing: 1em;
    	letter-spacing: 0.1cm;
    	min-height:1%;
    	}
    I did have problems getting the first letter to work in IE7 but someone pointed out to me that I need min-height:1%; which fixed it for me! Hope this helps! I was also recommended to read this article: http://www.satzansatz.de/cssd/onhavinglayout.html

  10. #10
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot for your help and time.

    right now i can't test your solutions cause ...i'm on hollyday

    next week i'll keep in touch and send you my results..


    thanks again

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •