본문 바로가기

[ programing ]/HTML + CSS

@font-face

  • @font-face font-family: 'kakaoFont';

    font-style: normal;/* 폰트 명 */

    font-weight: 100; /* 폰트 스타일 설정 */

    src: url('font/Kakao-aLt.eot');/* IE9 호환성 보기 */

    src: src:local(※);,/* 웹 브라우저가 지원하지 않는 불필요한 웹 폰트 호출을 막는데 사용 */

    url('font/Kakao-aLt.eot?#iefix') format('embedded-opentype'),/* IE6-IE8 */

    url('font/Kakao-aLt.woff2') format('woff2'),/* WOFF의 차기 포맷 */

    url('font/Kakao-aLt.woff') format('woff'),/* 표준 브라우저 */

    url('font/Kakao-aLt.ttf') format('truetype'),/* Safari, Android, iOS */

    url('font/Kakao-aLt.svg#KakaoaLt') format('svg');/* TTF에서도 커버가 안되는 기기들에 대한 대응 */

    }





    bodyfont-family:'kakaoFont'}

    /* 참고사항 : font-family 명이 같더라도 font-weight를 통하여 두께별로 설정이 가능합니다. (Light,bold,ExtraBold 등) 반대로 같은 폰트라도 font-family 명을 다르게 사용 하여 두께별로 사용 가능합니다 */



    출처: http://daumui.tistory.com/45 [다룸, Darum - 웹표준을 다루다]







  • https://www.fontsquirrel.com/tools/webfont-generator


    위 url에 접속하여 


    1. export(추출) 체크

    2. addfont 클릭

    3. font format 클릭 ( ttf, eot, wolf, svg )

    4. subsetting 카테고리에 no-subsseting 체크

    5. 맨아래 Yes, the fonts I'm uploading are legally eligible for web embedding. Agreement: 이 부분 체크!


    하면 상단에 다운로드 되는 프로그레스 상황을 볼수 있다!




    @font-face {

        font-family: 'NanumGothic';

        src: url('fonts/NanumGothic.eot');src:local(※);

        src: url('fonts/NanumGothic.eot?#iefix') format('embedded-opentype'),

             url('fonts/NanumGothic.woff2') format('woff2'),

             url('fonts/NanumGothic.woff') format('woff'),

             url('fonts/NanumGothic.ttf') format('truetype'),

             url('fonts/NanumGothic.svg#NanumGothic') format('svg');

       

    }



    나는 위와 같이 나눔고딕 폰트를 사용하였다.




    css에 위와같이 써주고

    body {font-family : NanumGothic ; }
    같이 쓰면 적용!



    또한 FTP 에 css가 있는 폴더 안에 fonts 폴더를 만들어서 위에서 만든 폰트 들을 업로드 하여 주었다.
    그래야 css에서 적용 가능 하다.