Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Font used for printing web page (Opera 12.17)

  • I've never noticed this before, but when I print a web page I wrote, it doesn't print in the same font it displays with. The relevant CSS element is simply "body {font-family: sans-serif; background-color:#fff980;}" and the web page displays in Opera with what looks like Arial, but when I print the page (or even Print Preview) it uses a serif font (looks like Times New Roman?)

    How can I specify within Opera and/or within the CSS style sheet to use the same sans-serif font when printing?

  • If you don't specify a specific font in the page coding, the browser will use its fallback default font for display and for printing.
    The default display font can be changed under Tools>Preferences>Advanced>Fonts, but I'm not sure about the printing fonts.
    Try putting "font-family: Arial, sans-serif;" in the CSS, if you want it to always display in Arial, and see if it then prints in Arial too.

  • I found the problem: user error, as usual.

    In the link to the CSS style sheet in the document header, for some reason, included a reference to screen:

    link rel="stylesheet" href="styles.css" type="text/css" media="screen"

    That apparently applies everything in the stylesheet to just the screen view, and not to print output, which makes sense. WIth that screen reference and lacking a separate stylesheet for print output, the default Opera font is serif. When I remove the media="screen" from the link, it works as I wanted/expected.

    Sorry for the bother!

  • (Is there a way to edit the thread title to add the word "SOLVED"?)

  • I don't think there is, unless the mods can do it, but glad you solved it!