css/js(工作中遇到的问题)

移动设备点击时去掉外加的蓝色边框

-webkit-tap-highlight-color: transparent;

获取宽高(这里附加了适配)

     window.gameWidth     = window.outerWidth  || window.innerWidth || screen.width
      window.gameHeight    = window.outerHeight || window.innerHeight || screen.height
      scaleToFitX   = window.gameWidth / 320
      scaleToFitY   = window.gameHeight / 548
      window.optimalRatio  = Math.min scaleToFitX, scaleToFitY

编辑placeholder

  :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    padding-left: 25px;
  }

  ::-moz-placeholder { /* Mozilla Firefox 19+ */
    padding-left: 25px;
  }

  input:-ms-input-placeholder,
  textarea:-ms-input-placeholder {
    padding-left: 25px;
  }

  input::-webkit-input-placeholder,
  textarea::-webkit-input-placeholder {
    padding-left: 25px;
  }
  • input不保存搜索记录
autocomplete='off'

元素宽高

  • 获取
elem.offsetHeight/offsetWidth;
  • 判断溢出
    if (element.offsetHeight < element.scrollHeight ||
        element.offsetWidth < element.scrollWidth) {
        // your element have overflow
    } else {
        // your element doesn't have overflow
    }

github分支命名

  • 样式修改: 'style';
  • 功能添加: feature;
  • 问题修复: bug;
  • 其他修改: chore

css百分比制作长宽相等

  • 宽度设置百分比后设置padding-top/padding-bottom100%;

你可能感兴趣的:(css)