最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

小米商城响应式学习_html/css

来源:懂视网 责编:小采 时间:2020-11-27 15:59:42
文档

小米商城响应式学习_html/css

小米商城响应式学习_html/css_WEB-ITnose:淘宝的手机网页一直是我所向往的。通过rem做的真正的响应式,但是总感觉更原先在pc上的做法大相径庭,也许是我理解不到。周末无意中发现小米的手机网页也是用em方式写的,看源码发现这正是我所追求的响应式wap网页。记录学习之~ 网址:http://m.mi.c
推荐度:
导读小米商城响应式学习_html/css_WEB-ITnose:淘宝的手机网页一直是我所向往的。通过rem做的真正的响应式,但是总感觉更原先在pc上的做法大相径庭,也许是我理解不到。周末无意中发现小米的手机网页也是用em方式写的,看源码发现这正是我所追求的响应式wap网页。记录学习之~ 网址:http://m.mi.c

淘宝的手机网页一直是我所向往的??通过rem做的真正的响应式,但是总感觉更原先在pc上的做法大相径庭,也许是我理解不到。周末无意中发现小米的手机网页也是用em方式写的,看源码发现这正是我所追求的响应式wap网页。记录学习之~

网址:http://m.mi.com

基础设置

  1. a标签去点击背景蓝色-webkit-tap-highlight-color: rgba(0,0,0,0);
  2. 禁用Webkit内核浏览器的文字大小调整功能-webkit-text-size-adjust: none;
  3. 允许长单词换行到下一行word-wrap:break-word;

元素单位(em)

  1. 包括:padding、margin、width、height、font-size、line-height等
  2. 通过全局的body设置基准字号

    body { font-size: 20px;}@media only screen and (max-width: 710px) and (min-width: 640px)body { font-size: 17.77778px;}

iconFont

  1. 全局样式设置

    @font-face { font-family: iconfont; src: url(/static/fonts/iconfont_2337a86.eot?9owfml); src: url(/static/fonts/iconfont_2337a86.eot?#iefix9owfml) format("embedded-opentype"),url(/static/fonts/iconfont_53935e1.woff?9owfml) format("woff"),url(/static/fonts/iconfont_bfbfeef.ttf?9owfml) format("truetype"),url(/static/fonts/iconfont_7a400bd.svg?9owfml#icomoon) format("svg"); font-weight: 400; font-style: normal}[class^=icon-], [class*=" icon-"], .iconfont { font-family: iconfont!important; speak: none; font-style: normal; font-weight: 400; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}
  2. 增加iconfont元素

    .page-index .nav-index li a .icon:before { font-size: 4em; color: #5c6066; line-height: 1.375em;}
    .icon-huafeichongzhi:before { content: "\e608";}
  3. 其它设置

    .page-index .nav-index li a .icon { display: block; margin: 0 auto .5em; width: 5em; height: 5em; -webkit-background-size: 5em 5em; -moz-background-size: 5em 5em; -ms-background-size: 5em 5em; -o-background-size: 5em 5em; background-size: 5em 5em;}

布局

  1. 用display: table;、display: table-row;、display: table-cell;、border-collapse: collapse;或display: box;、box-flex: 1;代替float:left布局
  2. 利用:first-child等伪类进行差异处理
  3. 图片基于父级的em宽高自适应

    .imgurl img { width: 100%;}li, img, label, input { vertical-align: middle;}
  4. 背景图大小通过background-size: 3.85em 2.7em;设置
  5. 内容垂直居中和内容水平居中

    div#DemoArea { display: box; box-align: start; -moz-box-align: start; -webkit-box-align: start; box-align: start;}
    div#DemoArea { display: box; box-align: start; -moz-box-pack:center; -webkit-box-pack:center; box-pack:center;}

总结反思

  1. 好多css3新技术应用进来让人耳目一新
  2. em作为单位还是rem更好操作些吧?

文档

小米商城响应式学习_html/css

小米商城响应式学习_html/css_WEB-ITnose:淘宝的手机网页一直是我所向往的。通过rem做的真正的响应式,但是总感觉更原先在pc上的做法大相径庭,也许是我理解不到。周末无意中发现小米的手机网页也是用em方式写的,看源码发现这正是我所追求的响应式wap网页。记录学习之~ 网址:http://m.mi.c
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top