csstagshtml-listsfont-family

Can i set a font family inside <li> tag?


I'm guessing not because I've been trying it with examples and nothing works...

I'm curious why not? And how can I set this?

Thanks


Solution

  • Sure you can. Just as for any other HTML element.

    ul li { font-family: Arial, Sans-Serif }
    

    Note that if the li contains other elements, and those elements have their own font-family settings, the value may get overridden. In that case, you'll have to specifically target the elements inside the li, e.g. for links:

    ul li a { font-family: Arial, Sans-Serif }