Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> JavaScript

Cải tiến trang web hiện có với CSS mobile


Để retrofit, dùng CSS media queries, cho phép stylesheet khác nhau cho khả năng trình duyệt khác nhau. Lợi ích: không cần code server-side.

Yêu cầu thêm code detection vào script để nhóm thiết bị.

Media queries xử lý cả thiết bị bạn chưa từng nghe đến.

Thiết lập:

@media handheld and (max-width: 480px), screen and (max-device-width: 480px), screen and (max-width: 600px) {    body {       color: blue;    } }