Media query

 

media query 在三個地方出現過分別是 link tag、style tag、css

 

一、link tag

<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" type="text/css" href="demo_screen.css">
    <link rel="stylesheet" type="text/css" href="demo_print.css" media="print">
</head>

<body>

</body>

</html>

 

二、style tag

<!DOCTYPE html>
<html>

<head>
    <style>
        h1 {
            color: #FF0000;
        }
    </style>

    <style media="print">
        h1 {
            color: #00FF00;
        }
    </style>
</head>

<body>
    <h1>W3Schools Example</h1>
</body>

</html>

 

三、css

請參考 CSS Media queries解說與max-width、min-width用法

 

參考資料:

HTML <link> media Attribute

HTML <style> media Attribute