Responsive

Điều kiện để responsive : 
<meta name="viewport" content="width=device-width, initial-scale=1">

CSS responsive : 
@media (min-width: 768px) {
    .container {
        width: 750px;
    }
}
@media (min-width: 992px) {
    .container {
        width: 970px;
    }
}
@media (min-width: 1280px) {
    .container {
        width: 1250px;
    }
}
@media screen and (max-width: 1024px) {
    .side-left,
    .main {
        float: left;
    }
    .side-right {
        display: none;
    }
    .side-left {
        width: 25%;
    }
    .main {
        width: 75%;
    }
    .title-header1, .title-header2, .title-header3 {
        float: none;
        width: 100%;
        border: none;
    }
}
@media screen and (max-width: 800px) {
    .side-left {
        display: none;
    }
    .side-right {
        display: none;
    }
    .main {
        width: 100%;
    }


}
@media screen and (max-width: 720px) {
    .header .da-slider {
        display: none;
    }
    .product {
        float: left;
        width: 50%;
        height: auto;
        padding-top: 15px;
        padding-left: 15px;
        padding-right: 15px;
        line-height: 1.5;
        border: 1px solid #ffffff;
    }
    .main {
        width: 100%;
    }
    .hinh img{
        width: 100%;
    }
    .noidungheader{
        width: 100%;
    }
    .footer .footer2, .footer4 {
        display: none;
        float: none;
    }
    .footer .footer1,.footer3{
        width: 100%;
        float: none;
    }
    .footer .footer1 img{
        margin-left: 5%;
    }

}
@media screen and (max-width: 480px) {

    .product {
        float: left;
        width: 100%;
        height: auto;
        padding-top: 15px;
        padding-left: 15px;
        padding-right: 15px;
        line-height: 1.5;
        border: 1px solid #ffffff;
    }
    .main {
        width: 100%;
    }

}

Comments

  1. muốn bắt tất cả các device thì làm sao ?

    ReplyDelete
    Replies
    1. Liệt kê thì hơi nhiều nha bạn mình liệt kê 1 số màn hình thông dụng trc, còn lại bạn xem thêm nha.
      @media only screen and (max-width: 1024px) {

      }

      @media only screen and (max-width: 980px) {

      }

      @media only screen and (max-width: 800px) {

      }

      @media only screen and (max-width: 780px) {

      }

      @media only screen and (max-width: 768px) {

      }

      @media only screen and (max-width: 720px) {

      }

      @media only screen and (max-width: 640px) {

      }

      @media only screen and (max-width: 600px) {

      }

      @media only screen and (max-width: 568px) {

      }

      @media only screen and (max-width: 563px) {

      }

      @media only screen and (max-width: 549px) {

      }

      @media only screen and (max-width: 534px) {

      }

      @media only screen and (max-width: 480px) {

      }

      @media only screen and (max-width: 360px) {

      }

      @media only screen and (max-width: 338px) {

      }

      @media only screen and (max-width: 330px) {

      }

      @media only screen and (max-width: 320px) {

      Delete

Post a Comment

Bài đăn phổ biến

Tính Bình Phương 1 Số Trong Python

Deploy website lên VPS hoặc Hosting với Gitlab CI/CD

Đổi tên "READ MORE" trong bài post

MỞ CAMERA VÀ CHỤP ẢNH BẰNG PHP