More then one font?

Discussion in 'CSS' started by pix582, Oct 7, 2009.

  1. #1
    Im coding the body and im trying to put 2 fonts together, e.g. Welcome

    so the "W" is in (Comic Sans MS)

    and "elcome" is in Garamond.

    can this be done?

    Thanks
     
    pix582, Oct 7, 2009 IP
  2. Valiant

    Valiant Peon

    Messages:
    284
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <style>
    body{
     font-family: Garamond;
    }
    </style>
    
    <span style="font-family:"Comic Sans MS">W</span>elcome
    
    Code (markup):
     
    Valiant, Oct 7, 2009 IP
  3. pix582

    pix582 Active Member

    Messages:
    313
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #3
    font is still the same.
     
    pix582, Oct 7, 2009 IP
  4. MhW

    MhW Active Member

    Messages:
    370
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    85
    #4
    valianting made a mistake and forgot to add a semi-colon.

    Still, inline styling is bad practice, if you plan on using this in more than one place on the website you should use the following method:

    CSS:
    
    body {
       margin: 0;
       padding: 0;
    }
    
    h1 {
       font-family: "Garamond", Times New Roman, Times, serif;
       font-size: 14px;
    }
    
    h1 span {
       font-family: Comic Sans MS;
       font-size: 20px;
    }
    Code (markup):
    HTML:
    
    <h1><span>W</span>elcome</h1>
    
    Code (markup):
    Of course, this is assuming you're only using it for a title. If not then change the <h1>'s to <p>'s or whatever...
     
    Last edited: Oct 7, 2009
    MhW, Oct 7, 2009 IP
  5. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Use the first-letter pseudo-element:

    body {
    font-family: Garamond, Verdana, Helvetica, FreeSans, Sans-serif;
    }
    
    p:first-letter {
    font-family: "Comic Sans MS";
    color: #ff0000;
    font-size: xx-large;
    }
    Code (markup):
     
    Masterful, Oct 7, 2009 IP
  6. pix582

    pix582 Active Member

    Messages:
    313
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #6
    @ MhW tnx done what i was looking for.
     
    pix582, Oct 8, 2009 IP