상용 코드 수집은 어떠한 기술적 함량도 없이 단지 구덩이를 메우는 축적일 뿐이다

43352 단어
1. css 2.x
  • 줄 바꿈
  • /*     */
    white-space:nowrap;
    /*    */
    word-wrap: break-word;
    word-break: normal;
    /*        */
    word-break:break-all;
  • 양쪽 정렬
  • text-align:justify;text-justify:inter-ideogra
  • Webkit(chrome) 브라우저에서 input(텍스트 상자)나textarea의 노란색 초점 상자를 제거
  • input,button,select,textarea{ outline:none;}
    textarea{ font-size:13px; resize:none;}
  • 크롬을 제거하고 비밀번호를 기억한 후 자동으로 폼을 채우는 노란색 배경
  • ie6: position:fixed
  • .fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0; }
    * html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
    *html{background-image:url(about:blank);background-attachment:fixed;}
  • clearfix
  • .clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0;}
    .clearfix{display:inline-block;}
    html[xmlns] .clearfix{display:block;}
    * html .clearfix{height:1%;}
    
    .clearfix{*zoom: 1;}
    .clearfix:after{clear:both;display:table;content:"”;}
    
    .clearfix{overflow:hidden;_zoom:1;}

    http://www.daqianduan.com/3606.html
  • seperate-table
  • .tab{border-collapse:separate;border:1px solid #e0e0e0;}
    .tab th,.tab td{padding:3px;font-size:12px;background:#f5f9fb;border:1px solid;border-color:#fff #deedf6 #deedf6 #fff;}
    .tab th{background:#edf4f0;}
    .tab tr.even td{background:#fff;}
    <table class="tab" width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <th>111th>
            <td>222td>
        tr>
        <tr>
            <th>111th>
            <td>222td>
        tr>
    table>
  • min-height: 최소 고도 호환 코드
  • .minheight500{min-height:500px;height:auto !important;height:500px;overflow:visible;}
  • 마우스 클릭 불가
  • cursor:not-allowed;
  • mac font:osx 플랫폼 글꼴 최적화
  • font-family:"Hiragino Sans GB","Hiragino Sans GB W3",'    ';
  • 문자가 너무 많으면 줄임표
  • .ellipsis,.ell{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

    2. css 3
  • 타이틀 줄 바꿈
  • 
  • x 기호 닫기
  • ×
  • 투영
  • .b{box-shadow:inset 1px -1px 0 #f1f1f1;text-shadow:1px 1px 0px #630;}
    filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#99000000',endColorstr='#99000000');background:rgba(0,0,0,.6);
    
    background:rgba(0,0,0,0.5);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#50000000',endColorstr='#50000000')\9;
  • search점유
  • ::-webkit-input-placeholder {}
    ::-moz-input-placeholder {}
    input:focus::-webkit-input-placeholder { color: transparent; }
    -webkit-appearance:none;  google    
    input[type="search"]{-webkit-appearance:textfield;} //   chrome    
    http://i.wanz.im/2011/02/04/remove_border_from_input_type_search/
    http://blog.csdn.net/do_it__/article/details/6789699
    line-height: normal; /* for non-ie */
    line-height: 22px\9; /* for ie */
  • 모든 브라우저의 호환 코드 생성 CSS는textArea의placeholder 줄 바꾸기
  • 기본 이벤트 차단
  • pointer-events:none;
  • 입력상자가 초점을 맞출 때의 흰색 배경을 제거
  • -webkit-user-modify: read-write-plaintext-only;
  • input:focus 시 input이 소프트 키보드에 따라 높아지지 않는 경우
  •  :focus{-webkit-tap-highlight-color:rgba(255, 255, 255, 0);
     -webkit-user-modify:read-write-plaintext-only;}
  • 회색변화gray
  • html{
        filter: grayscale(100%);
        -webkit-filter: grayscale(100%);
        -moz-filter: grayscale(100%);
        -ms-filter: grayscale(100%);
        -o-filter: grayscale(100%);
        filter: url("data:image/svg+xml;utf8,\'http://www.w3.org/2000/svg\'>\'grayscale\'>\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/>#grayscale");
        filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
        -webkit-filter: grayscale(1);
    }
  • Firefox 선택 차단
  • -moz-user-focus:ignore;-moz-user-input:disabled;-moz-user-select:none;
  • 화살표
  • display:block;border:solid transparent;line-height: 0;width:0; height:0;border-top:solid #0288ce;border-width:8px 6px 0 6px;
    
    border-style:solid; border-width:7px; border-color:transparent transparent transparent #ff7020;
    position:absolute;top: 0;left: 0;border-width:20px;border-style:solid;border-color:#d1ddde transparent transparent #d1ddde;

    ie6 버그 테스트,border-style을dashed로 설정합니다.
  • textarea 오른쪽 하단 모서리를 취소하고 손잡이를 드래그할 수 있음
  • resize:none
  • 크롬 폼의 초점 경계 해제
  • input,button,select,textarea{outline:none}
    textarea{resize:none}
  • a 링크의 노란색 테두리 취소
  • a{-webkit-tap-highlight-color:rgba(0,0,0,0);}
  • 웹키 수준 중간
  • display:-webkit-box;-webkit-box-pack:center; -webkit-box-align: center;
    position:absolute; top:50%;left:50%;transform:translate(-50%,-50%);
  • 크롬 검색 x 프롬프트 취소
  • input[type=search]::-webkit-search-decoration,
    input[type=search]::-webkit-search-cancel-button,
    input[type=search]::-webkit-search-results-button,
    input[type=search]::-webkit-search-results-decoration {
        display: none;
    }
  • 크롬 기본 노란색 배경 취소
  • input:-webkit-autofill {-webkit-box-shadow: 0 0 0px 1000px white inset;}
    input:-webkit-autofill,
    textarea:-webkit-autofill,
    select:-webkit-autofill {
        -webkit-box-shadow: 0 0 0 1000px white inset;
    }
    autocomplete="off"
  • 핸드폰 버전 홈페이지 a 표기 점선상자 문제
  • a:focus {outline:none;-moz-outline:none;}
  • 초점 제거 배경
  • -webkit-tap-highlight-color:rgba(255, 255, 255, 0);
    -webkit-tap-highlight-color:transparent;  // i.e. Nexus5/Chrome and Kindle Fire HD 7''
  • placeholder 자리 표시자 색상 사용자 정의
  • input:-moz-placeholder {color: #369;}
    ::-webkit-input-placeholder {color:#369;}
  • IOS 비활성화 강조
  • -webkit-tap-highlight-color:rgba(255,0,0,0.5);-webkit-tap-highlight-color:transparent; /* For some Androids */
  • IOS iframe 스크롤 롤백 효과
  • -webkit-overflow-scrolling:touch;overflow-y:scroll;
  • 텍스트 선택 금지
  • -moz-user-select:none;
    -webkit-user-select:none;
    -ms-user-select:none;
    user-select:none;
  • 모호(모유리) 효과 1
  • 모호(모유리) 효과 2
  • 흐림(모유리) 리얼리티
  • .blur {    
        -webkit-filter: blur(10px); /* Chrome, Opera */
           -moz-filter: blur(10px);
            -ms-filter: blur(10px);    
                filter: blur(10px);    
    }
    <img src="mm1.jpg" />
    <img src="mm1.jpg" class="blur" />
  • 회전 로드맵 표시, 드롭다운 로드 데이터
  • #pullDown .pullDownIcon{display:inline-block;vertical-align:middle;width:40px;height:40px;background:url(https://github.com/chalecao/chale/blob/master/pull-icon%402x.png) 0 0 no-repeat;-webkit-background-size:40px 80px;background-size:40px 80px;-webkit-transition-property:-webkit-transform;-webkit-transition-duration:250ms}
    #pullDown .pullDownIcon{-webkit-transform:rotate(0deg) translateZ(0)}
    #pullDown .pullDownLabel{display:inline-block;vertical-align:middle;margin-left:5px;}
    #pullDown.flip .pullDownIcon{-webkit-transform:rotate(-180deg) translateZ(0)}
    #pullDown.loading .pullDownIcon{background-position:0 100%;-webkit-transform:rotate(0deg) translateZ(0);-webkit-transition-duration:0ms;-webkit-animation-name:loading;-webkit-animation-duration:2s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear}
    @-webkit-keyframes loading{
        from{-webkit-transform:rotate(0deg) translateZ(0)}
        to{-webkit-transform:rotate(360deg) translateZ(0)}
    }
    
    <div id="pullDown" class="none loading">
        <span class="pullDownIcon">span><span class="pullDownLabel">     ...span>
    div>
  • 핸드폰 다중 단말기 미디어query 웹 앱 아이폰4 아이폰5 아이폰6 응답 레이아웃 어댑터 코드
  • @media (device-height:480px) and (-webkit-min-device-pixel-ratio:2){/*   iphone4/4s */
        .class{}
    }
    @media (device-height:568px) and (-webkit-min-device-pixel-ratio:2){/*   iphone5 */
        .class{}
    }
    @media (device-height:667px) and (-webkit-min-device-pixel-ratio:2){/*   iphone6 */
        .class{}
    }
    @media (device-height:736px) and (-webkit-min-device-pixel-ratio:2){/*   iphone6 Plus */
        .class{}
    }
  • 애플 브라우저가 숫자에 대한 식별 메타 탭의format-detection 속성 및 의미 차단
  • <meta content="telephone=no" name="format-detection">
  • type="number"에서 HTML5 input 제거 시 위아래 작은 화살표
  • 크롬 아래:
  •   input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{
          -webkit-appearance: none !important;
          margin: 0; 
      }
  • Firefox 아래:
  •   input[type="number"]{-moz-appearance:textfield;}
  • 두 번째 방안:
  • type="number"를 type="tel"로 바꾸면 같은 숫자 키보드지만 화살표가 없습니다.


  • HTML5 핸드폰 조회는 한 번호로 직접 전화하고 문자를 보낸다
  • <a href="tel:15222222222">  WEB  JS          a>
    <a href="sms:15222222222">  WEB  JS          a>
    
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="x-rim-auto-match" content="none">
  • CSS판단가로세로
  • @media screen and (orientation: portrait) {
      /*   css*/
    } 
    @media screen and (orientation: landscape) {
      /*   css*/
    }
    //         :
    window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
            if (window.orientation === 180 || window.orientation === 0) { 
                alert('');
            } 
            if (window.orientation === 90 || window.orientation === -90 ){ 
                alert('');
            }  
        }, false); 
    //            window.orientation    ,                        。
    =====================================================
        :https://github.com/jsfront/src/blob/master/css.md

    좋은 웹페이지 즐겨찾기