简体   繁体   中英

Using different media stylesheets together with a print stylesheet

I have a school assignment that I can't for the life of me figure out. We've been asked to explain the difference between the two following ways of linking a print stylesheet along with a different stylesheet in HTML, and explain in which situations we would use which technique:

<link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen” />
<link rel="stylesheet" type="text/css" href="print.css" media="print” />

or

<link rel="stylesheet" type="text/css" href="stylesheet.css" media="all” />
<link rel="stylesheet" type="text/css" href="print.css" media="print” />

Can someone please give me a pointer as to how screen and all are different when it comes to using them together with a separate print stylesheet?

Not trying to do your homework, but feeling your pain. media="screen" makes that link statement only apply to the screen HTML. Remember there are many types of media, so specifying media="screen" limits it. Media="all" is the default and will apply to all not specified or overridden otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM