6
此前,下面的代碼工作正常的Firefox和谷歌瀏覽器,當我打印到「隱藏」的元素,CSS @media打印規則不起作用了嗎?
<!DOCTYPE html>
<html><head><title>Test</title>
<style type="text/css">
@media print {
.noprint {
display: none;
}
}
</style>
</head>
<body>
<span class="noprint">abc</span>
</body></html>
但現在,它並不適用於這兩種瀏覽器。但是,如果我更改爲此,
<!DOCTYPE html>
<html><head><title>Test</title>
<style type="text/css" media="print">
.noprint {
display: none;
}
</style>
</head>
<body>
<span class="noprint">abc</span>
</body></html>
它可以在Firefox上使用,但不能在Google Chrome上使用。 什麼是獨立於瀏覽器的解決方案? (或者是有什麼錯我的代碼?)
'