网易面试回来

1. CSS方面的笔试题

印象最深刻的CSS方面的题只有两道:

  • 左侧定宽,右侧自适应填满屏幕;
   1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   2: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   3: <head>
   4:     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
   5:         <title>网易面试题</title>
   6:     <style>
   7:         /**
   8:          * 左侧定宽,右侧自适应填满屏幕;
   9:          * 兼容包括IE6的主流浏览器
  10:          */
  11:         
  12:         * {
  13:             margin: 0; padding: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
  14:         }
  15:         #head {
  16:             width: 100%; height: 80px;
  17:             background: #800040;
  18:         }
  19:  
  20:         #body {
  21:             width: 100%;
  22:         }
  23:  
  24:         #left {
  25:             float: left;
  26:         }
  27:  
  28:         #left {
  29:             width: 200px; height: 300px;
  30:             background: #80FF80
  31:         }
  32:  
  33:         #right {
  34:             overflow: hidden;
  35:             height: 300px;
  36:             background: #008040;
  37:         }
  38:  
  39:         #foot {
  40:             float: left;
  41:             width: 100%; height: 50px;
  42:             background: #808000;
  43:         }
  44:     </style>
  45: </head>
  46: <body>
  47:     <div id="head">头部,高度100px,宽度占满屏幕。</div>
  48:     <div id="body">
  49:         <div id="left">
  50:             左侧控制栏,宽度200px,最小高度500px。<input type="button" value="切换">
  51:         </div>
  52:         <div id="right">
  53:             右侧内容栏,最小高度500px,宽度占满剩余屏幕。<input type="button" value="切换">
  54:         </div>
  55:     </div>
  56:     <div id="foot">底部,高度100px,宽度占满屏幕。并且foot紧贴在left和right里最高的元素边缘。</div>
  57: </body>
  58: <script>
   1:  

   2:     var aInput = document.getElementsByTagName('input');

   3:     for(i in aInput) {

   4:         aInput[i].onclick=function(){

   5:             this.parentNode.style.height = '500px';

   6:         }

   7:     }
</script>
  59: </html>
  • 定宽定高容器里文本的绝对居中问题(水平和垂直都居中);

 

2. JS方面的笔试题

posted on 2014-03-16 02:25  大别针儿  阅读(221)  评论(0)    收藏  举报