web——媒体查询

定位布局

媒体查询的代码:



<html>
    <head>
        <meta charset="UTF-8">
        <title>title>
        <style>
            .a{
                border: 1px solid #000000;
                width: 100px;
                height: 100px;
                background-color: #000000;
            }

            @media only screen and (min-width: 300px) and (max-width: 640px) {
                .a{
                    background-color: red;
                }
            }

            @media only screen and (min-width: 700px) {
                .a{
                    background-color: green;
                }
            }

            @media only screen and (max-width:200px ) {
                .a{
                    background-color: blue;
                }
            }
        style>
    head>
    <body>
        <div class="a">div>
    body>
html>

你可能感兴趣的:(web前端开发)