分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

使用@media screen实现网页适应不同的分辨率

发布时间:2023-09-06 01:21责任编辑:苏小强关键词:暂无标签

响应式web设计之@media

有多种使用方式:

1、在link中判断屏幕宽高,然后引用不同的css文件:
<link rel="stylesheet" type="text/css" href="style.css" media="screen and (min-width: 800px)">

2、写在样式文件中,通过判断屏幕宽高适应不同分辨率

//适应宽度
@media screen and (max-width: 1365px) { ?body { ???font-size: 10px; ?}}@media screen and (min-width: 1366px) and (max-width: 1599px) { ?body { ???font-size: 12px; ?}}@media screen and (min-width: 1600px) and (max-width: 1919px) { ?body { ???font-size: 14px; ?}}@media screen and (min-width: 1920px) { ?body { ???font-size: 16px; ?}}
//适应高度
@media screen and (min-height: 901px) and (max-height: 1080px){ ?body { ???font-size: 16px; ?}}

@media screen and (min-height: 800px) and (max-height: 900px){

?body {
 ???font-size: 16px; ?}}

使用@media screen实现网页适应不同的分辨率

原文地址:http://www.cnblogs.com/zhouzhou826/p/7765720.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved