响应式web设计之CSS3 Media Queries

<!DOCTYPE HTML>
<html>
<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>css3-media-queries-demo</title>`` <style> body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td { padding: 0; margin: 0; } .content{ zoom:1; } .content:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .leftBox, .rightBox{ float: left; width: 20%; height: 500px; margin: 5px; background: #ffccf7; display: inline; -webkit-transition: width 1s ease; -moz-transition: width 1s ease; -o-transition: width 1s ease; -ms-transition: width 2s ease; transition: width 1s ease; } .middleBox{ float: left; width: 50%; height: 800px; margin: 5px; background: #b1fffc; display: inline; -webkit-transition: width 1s ease; -moz-transition: width 1s ease; -o-transition: width 1s ease; -ms-transition: width 1s ease; transition: width 1s ease; } .rightBox{ background: #fffab1; } @media only screen and (min-width: 1024px){ .content{ width: 1000px; margin: auto } } @media only screen and (min-width: 400px) and (max-width: 1024px){ .rightBox{ width: 0; } .leftBox{ width: 30%} .middleBox{ width: 65%} } @media only screen and (max-width: 400px){ .leftBox, .rightBox, .middleBox{ width: 98%; height: 200px; } } </style> </head>

<body> <div class="content"> <div class="leftBox"></div> <div class="middleBox"></div> <div class="rightBox"></div> </div> </body>
</html>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 1,815评论 0 2
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,349评论 0 11
  • 笔记参考自《响应式Web设计:HTML5和CSS3实践》,2013年出版内容说不上最新。如下是全书的章的目录:第 ...
    于晓鱼阅读 969评论 0 1
  • 因为有机会参与一个项目的早期设计,因此搭建的时候不可避免的遇到了如何满足响应式的问题。翻阅了《响应式Web设计:H...
    tangyefei阅读 6,486评论 2 90
  • 2017年9月18日,星期一。 最近,“身心灵”算是一个比较热门的话题,而且好多人都在强调身心灵合一。那么什么才算...
    Ms娟子阅读 189评论 0 0