:tools: Scheduled maintenance

Heads up! Downtime for the Forums, related to the NodeBB upgrade, is planned for Thursday, December 14, starting from 10:00 UTC.
Please make sure to finish all your posts before this time. The downtime should only last for a few minutes.

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!
    :-)

Log in to reply
 

Looks like your connection to Opera forums was lost, please wait while we try to reconnect.