WebFont @font-face Define Serif/sans-serif/monospace

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs WebFont @font-face define serif/sans-serif/monospace Ask Question Asked 9 years, 3 months ago Modified 9 years, 3 months ago Viewed 840 times 5

I use many web fonts in my site, and now I want to add new font family which has serif/sans-serif/monospace type of font. Part of my css:

@font-face { font-family: 'DejaVu', sans-serif; font-weight: 400; font-style: normal; src: url(dejavu/DejaVuSans.ttf) } @font-face { font-family: 'DejaVu', monospace; font-weight: 400; font-style: normal; src: url(dejavu/DejaVuSansMono.ttf); } @font-face { font-family: 'DejaVu', serif; font-weight: 400; font-style: normal; src: url(dejavu/DejaVuSerif.ttf); }

But it doesn't work(In css console I see error like: bad value for font-family). Is there any way to make it work using only one name for font.

I know that I can change font-family name to look like: 'DejaVu Serif' but I don't want to.

Share Improve this question Follow asked Sep 28, 2015 at 8:58 Manveru's user avatar ManveruManveru 9451 gold badge10 silver badges24 bronze badges Add a comment |

1 Answer 1

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 3

The answer is no, the only way would be to change the font-family name to include the font definition.

You could set the font-style or font-weight and use those to select your font-face but you can't stack a font-face family.

Share Improve this answer Follow answered Sep 28, 2015 at 9:10 Aaron's user avatar AaronAaron 10.4k3 gold badges26 silver badges41 bronze badges Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • How AI apps are like Google Search
  • Featured on Meta
  • The December 2024 Community Asks Sprint has been moved to March 2025 (and...
  • Stack Overflow Jobs is expanding to more countries
1 @font-face for all fonts on a website 8 Implementing @font-face as of late 2012 3 Working with web (@font-face) fonts 1 web-fonts rendering 12 @font-face, font variants 2 Browser @font-face TTF support 1 How to make @font-face fonts work 1 web font doesn't get applied! @font-face 1 webfonts: @font-face should include font-style and font-weight? 0 font-face CSS does not appear in HTML

Hot Network Questions

  • How to Achieve a Realistic Concrete Texture in Blender?
  • 2 network cards on 1 ubuntu server netplan config
  • Does gravity from a star go through a black hole's event horizon to affect objects on the other side?
  • How can I document that I am allowed to travel to the UK from Scandinavia using eVisa/BRP? (Denied at the check-in counter)
  • Is this an effective way to quickly switch between two gain settings in an inverting amplifier configuration?
  • Online Service Course in the era of ChatGPT
  • How can I put logo on left of the page next to institute name?
  • A world with limited collective ability
  • Unable to locate package bcmwl-kernel-source
  • exploratory factor analysis, non-normal data
  • When re-implementing software, does analyzing the original software's kernel-calls make the re-implementation a derived work?
  • solana/web3.js 2.0 Issue With Using a Durable Nonce as a Lifetime
  • How to do the opposite of shift in zsh?
  • Question regarding one modification of one inequality of Young type
  • Is "Klassenarbeitsangst" a real word? Does it accord with general rules of compound noun formation?
  • Growing plants on mars to increase the oxygen level
  • What is this FreeDOS kernel loader found on the “W3x4NTFS” disk image?
  • Varying output from single file
  • Simple U-Arrow above Arrow in tikz
  • How does FM preemphasis interact with maximum deviation?
  • US Citizen Proposing to Foreigner
  • A miniature Thermometer Sudoku (ThermoDoku)
  • Air launch separation mechanism
  • Escape braces in C# interpolated raw string literal
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-html

Từ khóa » Html Font Face Sans Serif