CSS: Styling numbers and text with different fonts

后端 未结 3 1861
后悔当初
后悔当初 2021-02-06 05:05

I\'d like that all the numbers and all the punctuation in my website have a font-family, while the rest of the text has another. (Example: numbers and punctuation in Arial and t

3条回答
  •  悲&欢浪女
    2021-02-06 05:40

    You can set one font-family for your body i.e. Tahoma, and then wrap any of your numbers and punctuation marks inside a tag, for e.g. and then set a different font-family for the span tag using CSS like this:

    .numbers {
         font-family: Arial;
    }
    

    Here's an example:

    body {
      font-family: Arial;
    }
    .numbers {
      font-family: Tahoma;
      color: red;
    }
    Lorem ipsum dolor ismet. Lorem ipsum dolor ismet. Lorem ipsum dolor ismet 123-456-789. Lorem ipsum dolor ismet. Lorem ipsum dolor ismet. Lorem ipsum dolor ismet. Lorem ipsum dolor ismet. Lorem ipsum dolor ismet. Lorem ipsum
    dolor ismet. Lorem ipsum dolor ismet. "Lorem ipsum dolor ismet". Hello World???????

提交回复
热议问题