Category: Web Design

  • HTML 글자 표현 방법

    HTML 문서에서 자주 사용하는 글자 표현 방법에 관한 예제를 살펴보겠습니다.

    Headings : h1 ~ h6을 기본 스타일로 사용하기

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>브라우저 기본 제목 스타일</title>
    </head>
    <body>
        <h1>Heading 1 (h1)</h1>
        <h2>Heading 2 (h2)</h2>
        <h3>Heading 3 (h3)</h3>
        <h4>Heading 4 (h4)</h4>
        <h5>Heading 5 (h5)</h5>
        <h6>Heading 6 (h6)</h6>
    </body>
    </html>

    크기는 중요하지 않습니다 : CSS로 선택하는 모든 크기의 헤딩 만들기

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>제목에 스타일 적용</title>
        <style>
            h1 {
              font-size: 0.67em;
              margin: 2.33em 0;
            }
            h2 {
              font-size: 0.83em;
              margin: 1.67em 0;
            }
            h3 {
              margin: 1.33em 0;
            }
            h4 {
              font-size: 1.17em;
              margin: 1em 0;
            }
            h5 {
              font-size: 1.5em;
              margin: .83em 0;
            }
            h6 {
              font-size: 2em;
              margin: .67em 0;
            }
        </style>
    </head>
    <body>
        <h1>Heading 1 (h1)</h1>
        <h2>Heading 2 (h2)</h2>
        <h3>Heading 3 (h3)</h3>
        <h4>Heading 4 (h4)</h4>
        <h5>Heading 5 (h5)</h5>
        <h6>Heading 6 (h6)</h6>
    </body>
    </html>

    Bold, italics, case 및 줄 간격(line-height) :  font-weight, font-style, font-variant, text-transform, line-height

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Bold, italics, case와 line-height</title>
        <style>
            body {
                font-size: 25px;
            }
            p {
                margin: 50px 0;
            }
            code {
                color: #c00;
            }
            #p1 {
                font-weight: bold;
            }
            #p2 {
                font-style: italic;
            }
            #p3 {
                font-variant: small-caps;
            }
            #p4 {
                text-transform: uppercase;
            }
            #p5 {
                line-height: 2;
            }
        </style>
    </head>
    <body>
        <p id="p1"><code>font-weight</code>: Bold or light text. Eg. <code>font-weight: bold;</code></p>
        <p id="p2"><code>font-style</code>: Italic or oblique text. Eg. <code>font-style: italic;</code></p>
        <p id="p3"><code>font-variant</code>: Small capitals. Replaces lowercase letters with uppercase letters that are a similar height to the original lowercase ones. Eg. <code>font-variant: small-caps;</code></p>
        <p id="p4"><code>text-transform</code>: Converts the case of letters, to uppercase, lowercase, or capitalized. Eg. <code>text-transform: uppercase;</code></p>
        <p id="p5"><code>line-height</code>: The minimal height for a line of text. Apparnet in longer lines, such as "The green seed of the white-flowering climbing leguminous papilionaceous plant, <em>Pisum sativum</em>, has become a dining-table favourite for good reason. The <strong>perfect</strong> accompaniment to any meal, the diminutive spherical vegetables brings joy to billions worldwide, be they fresh, frozen, canned or dried." Eg. <code>line-height: 2;</code></p>
    </body>
    </html>

    Font families : 글꼴 패밀리(font-family) 목록 및 일반 대체 글꼴 패밀리(generic fallback font families)

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Font families</title>
        <style>
            h2 { color: green; }
        
            #p1 { font-family: Times, "Times New Roman", serif; }
            #p2 { font-family: Helvetica, Arial, sans-serif; }
            #p3 { font-family: serif; }
            #p4 { font-family: sans-serif; }
            #p5 { font-family: monospace; }
            #p6 { font-family: cursive; }
            #p7 { font-family: fantasy; }
        
            .s1 { font-style: italic; }
            .s2 { font-style: oblique; }
            .s3 { font-weight: bold; }
            .s4 { font-weight: 100; }
        </style>
    </head>
    <body>
        <h1>Font Families</h1>
        <p>Used with CSS. Two common font combination lists and the five generic fallback font families.</p>
        <h2>font-family: Times, "Times New Roman", serif</h2>
        <p id="p1">
                Behold! A serif font family list!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
        <h2>font-family: Helvetica, Arial, sans-serif</h2>
        <p id="p2">
                Behold! A sans-serif font family list!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
        <h2>font-family: serif</h2>
        <p id="p3">
                Behold! The serif generic font family!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
        <h2>font-family: sans-serif</h2>
        <p id="p4">
                Behold! The sans-serif generic font family!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
        <h2>font-family: monospace</h2>
        <p id="p5">
                Behold! The monospace generic font family!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
        <h2>font-family: cursive</h2>
        <p id="p6">
                Behold! The cursive font family!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
        <h2>font-family: fantasy</h2>
        <p id="p7">
                Behold! The fantasy generic font family!
                <span class="s1">It swooshes with an italic font-style!</span>
                <span class="s2">It leans with an oblique font-style!</span>
                <span class="s3">It puffs out with a bold font-weight!</span>
                <span class="s4">It sucks in with a 100 font-weight!</span>
        </p>
    </body>
    </html>

    글자 크기 : 절대 및 상대 단위

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Font sizes</title>
        <style>
        * {
            margin: 0;
        }
        body {
            font-size: 20px;
            line-height: 1.5;
            margin: 20px;
        }
        code {
            color: #c00;
        }
        h2 {
            margin-top: 20px;
        }
        #len1 {
            font-size: 12px;
        }
        #len2 {
            font-size: 12pt;
        }
        #len3 {
            font-size: 12q;
        }
        #len4 {
            font-size: 1.2ex;
        }
        #len5 {
            font-size: 1.2em;
        }
        #len6 {
            font-size: 1.2vmax; /* not supported by Internet Explorer */
        }
        #pc1 {
            font-size: 50%;
        }
        #pc2 {
            font-size: 100%;
        }
        #pc3 {
            font-size: 150%;
        }
        #kw1 {
            font-size: x-small;
        }
        #kw2 {
            font-size: medium;
        }
        #kw3 {
            font-size: x-large;
        }
        </style>
    </head>
    <body>
        <h1>Font Sizes</h1>
        <p>Font sizes can be set using the <code>font-size</code> property, the value of which can be a length, percentage, or keyword.</p>
        <h2>Lengths</h2>
        <h3>Absolute lengths</h3>
        <ul>
            <li><code id="len1">font-size: 12px</code></li>
            <li><code id="len2">font-size: 12pt</code></li>
            <li><code id="len3">font-size: 12q</code></li>
        </ul>
        <h3>Relative lengths</h3>
        <ul>
            <li><code id="len4">font-size: 1.2ex</code></li>
            <li><code id="len5">font-size: 1.2em</code></li>
            <li><code id="len6">font-size: 1.2vmax</code></li>
        </ul>
        <h2>Percentage</h2>
        <ul>
            <li><code id="pc1">font-size: 50%</code></li>
            <li><code id="pc2">font-size: 100%</code></li>
            <li><code id="pc3">font-size: 150%</code></li>
        </ul>
        <h2>Keywords</h2>
        <ul>
            <li><code id="kw1">font-size: x-small</code></li>
            <li><code id="kw2">font-size: medium</code></li>
            <li><code id="kw3">font-size: x-large</code></li>
        </ul>
    </body>
    </html>

    글자 간격 : text-align, text-indent, word-spacing, letter-spacing

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Text-align, text-indent, word and letter spacing</title>
        <style>
            body {
                font: 150% arial, helvetica, sans-serif;
            }
            #p5 {
                text-indent: 2em;
                word-spacing: 1em;
            }
            #p6 {
                text-align: justify;
                letter-spacing: 0.1em;
            }
        </style>
    </head>
    <body>
        <p id="p5">Even leaving aside the astounding nutritional package, the taste explosion and texture of a well cooked pea is undeniably enough to award this deceptively simple seed the gold-medal of the foodstuff Olympics.</p>
        <p id="p6">There is debate surrounding the tampering of the form of the original spherical vegetable. The question as to whether the 'mushy' pea is sacrilege or an innovative approach to re-package the perfect product is a sensitive issue. A similar argument arises when approaching the relatively new craze of mangetout. In-depth study is required, but for now it is too early to assess the true importance of this baby pea pod.</p>
    </body>
    </html>

    수직 정렬 :  vertical-align

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>vertical-align</title>
        <style>
            p {
                font: 1em arial, helvetica, sans-serif;
                width: 780px;
            }
            #va {
                font-size: 40px;
            }
            #zero {
                font-size: 0.5em;
                vertical-align: text-top;
            }
            #one {
                font-size: 0.5em;
                vertical-align: top;
            }
            #two {
                vertical-align: -0.5em;
            }
            #three {
                font-size: 0.5em;
                vertical-align: middle;
            }
            #four {
                font-size: 0.5em;
                vertical-align: sub;
            }
            #five {
                font-size: 1.5em;
                vertical-align: 0.5em;
            }
            #six {
                font-size: 0.5em;
                vertical-align: super;
            }
            #seven {
                color: #0a0;
                vertical-align: super;
            }
        </style>
    </head>
    <body>
        <p id="va"><span id="zero">A</span> daft <span id="one">example</span> to <span id="two">show</span> what <span id="three">can</span> be <span id="four">achieved</span> with the <code id="five">vertical-align</code> CSS <span id="six">property</span>.</p>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in <span id="seven">Boo!</span> voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </body>
    </html>

    아래 첨자와 위첨자 : 위치 지정을 vertical-align속성 의 대안으로 사용

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Superscript and subscript</title>
        <style>
            body { font: 100% "Times New Roman", Times, serif }
            p { line-height: 1.5 }
            .charge {
                position: relative;
                bottom: 0.5em;
                color: red;
                font-size: 0.8em;
            }
            .atoms {
                position: relative;
                top: 0.3em;
                color: blue;
                font-size: 0.8em;
            }
        </style>
    </head>
    <body>
        <p>My name is Doctor Womac and I am going to teach you all about chemical formulae. A chemical formula is a way to describe the chemical elements that make up a particular chemical compound. It consists of chemical symbols to covey the elements and numbers to show the number of atoms of each element. H<span class="atoms">2</span>SO<span class="atoms">4</span> is the chemical formula for sulphur for example. The charge of an ion can be displayed in superscript, such as Au<span class="charge">2+</span>. This concludes my lesson. I must rush off home now because I have a problem with some radioactive phosphate.</p>
    </body>
    </html>

    그림자 글자

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Text shadows</title>
        <style>
            body {
                font: 20px/2 "times new roman", times, serif;
                color: #000;
            }
            h1 {
                text-shadow: -2px 2px 2px #999;
            }
            em {
                font-weight: bold;
                padding: 8px;
            }
            #elephant {
                color: #eee;
                background: #999;
                text-shadow: 2px 1px 0 #000;
            }
            #plesiosaur {
                background: #bde;
                color: #06c;
                text-shadow: 0 -3px 1px #fff;
            }
            #tourist {
                color: #efa;
                background: #be0;
                text-shadow: 0 0 4px #360;
            }
        </style>
    </head>
    <body>
        <h1>A little tale accompanied by a little text shadow</h1>
        <p>In Botswana's Chobe National Park, <em id="elephant">an elephant with an especially large trunk</em> is minding its own business when <em id="plesiosaur">a plesiosaur with five heads, two tails, and the legs of a lion</em> falls out of the sky and lands on the elephant's back.</p>
        <p>"Hah hah! That's hilarious!", says the plesiosaur, "Your trunk is huge!"</p>
        <p><em id="tourist">A stunned tourist in a nearby Jeep</em> drops his camera, stares in amazement, and excitedly taps his wife on the shoulder.</p>
        <p>"Look, honey! That's amazing! The talking prehistoric marine reptile with five heads, two tails, and the legs of a lion that fell out of the sky is right! That elephant's trunk is ginormous!"</p>
    </body>
    </html>

    간단한 드롭 캡(drop caps) : 일반적인 효과를 얻을 수있는 간단한 방법입니다.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Drop caps 1</title>
        <style>
            body {
                font: 15px/1.5 arial, helvetica, sans-serif;
            }
            p:first-letter {
                float: left;
                font-size: 45px;
                line-height: 1;
                font-weight: bold;
                margin-right: 9px;
            }
        </style>
    </head>
    <body>
        <p>Once upon a time in a blueberry bubblegum land covered in pink violets that swayed to the rhythm of "My Baby Just Cares for Me" there lived a podgy yet attractive raspberry fairy called Bedooda. Bedooda was as tall as a button bush and as intelligent as a peach mystic from the Unscented Hills (not the Scented Hills - the mystics there were not too bright) and was an adored member of the raspberry family but she was an unhappy raspberry fairy. As unhappy as a lost sunfish from the Sweet Spaghetti River.</p>
    </body>
    </html>

    장식 드롭 캡(drop caps)

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Fancy drop caps</title>
        <style>
            body {
                font: 15px/1.5 arial, helvetica, sans-serif;
            }
            p:first-letter {
                float: left;
                font-size: 45px;
                line-height: 1;
                font-weight: bold;
                margin-right: 9px;
                color: #9c0;
                font-family: "Times New Roman", Times, serif;
                text-shadow: #690 .05em .05em;
            }
        </style>
    </head>
    <body>
        <p>Once upon a time in a blueberry bubblegum land covered in pink violets that swayed to the rhythm of "My Baby Just Cares for Me" there lived a podgy yet attractive raspberry fairy called Bedooda. Bedooda was as tall as a button bush and as intelligent as a peach mystic from the Unscented Hills (not the Scented Hills - the mystics there were not too bright) and was an adored member of the raspberry family but she was an unhappy raspberry fairy. As unhappy as a lost sunfish from the Sweet Spaghetti River.</p>
    </body>
    </html>

    그래픽 드롭 캡(drop caps) : 이미지 사용

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Drop caps 2</title>
        <style>
            body {
                font: 15px/2 arial, helvetica, sans-serif;
            }
            p:first-letter {
                float: left;
                font-size: .1px;
                background: url("./img/o.gif") no-repeat;
                padding: 50px 0 0 40px;
                margin-right: 9px;
            }
        </style>
    </head>
    <body>
        <p>Once upon a time in a blueberry bubblegum land covered in pink violets that swayed to the rhythm of "My Baby Just Cares for Me" there lived a podgy yet attractive raspberry fairy called Bedooda. Bedooda was as tall as a button bush and as intelligent as a peach mystic from the Unscented Hills (not the Scented Hills - the mystics there were not too bright) and was an adored member of the raspberry family but she was an unhappy raspberry fairy. As unhappy as a lost sunfish from the Sweet Spaghetti River.</p>
    </body>
    </html>

    첫 단락 드롭 캡 대문자 : 첫 번째 단락의 첫 번째 글자를 대상으로 지정합니다.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Drop caps 3</title>
        <style>
            body {
                font: 15px/2 arial, helvetica, sans-serif;
            }
            p:first-of-type:first-letter {
                float: left;
                font-size: 45px;
                line-height: 1;
                font-weight: bold;
                margin-right: 9px;
            }
        </style>
    </head>
    <body>
        <p>Once upon a time in a blueberry bubblegum land covered in pink violets that swayed to the rhythm of "My Baby Just Cares for Me" there lived a podgy yet attractive raspberry fairy called Bedooda.</p>
        <p>Bedooda was as tall as a button bush and as intelligent as a peach mystic from the Unscented Hills (not the Scented Hills - the mystics there were not too bright) and was an adored member of the raspberry family but she was an unhappy raspberry fairy. As unhappy as a lost sunfish from the Sweet Spaghetti River.</p>
        <p>The End.</p>
    </body>
    </html>

    따옴표 붙이기 1 : 단순한 따옴표 구조

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Pull quotes 1</title>
        <style>
            body {
                font: 13px/1.5 arial, helvetica, sans-serif;
            }
            article {
                width: 500px;
            }
            .pquote {
                float: left;
                width: 100px;
                background: #ddf;
                font-weight: bold;
                padding: 13px;
                margin: 0 13px 13px 0;
            }
            blockquote {
                margin: 0;
            }
        </style>
    </head>
    <body>
        <article>
            <p>If ever there was evidence of God, the humble pea is it.</p>
            <p>Mother Nature has never created something of such perfection, something that takes Darwin's theory of evolution to the extent that a natural element can, over millions of years, evolve into something so flawless.</p>
            <aside class="pquote">
                <blockquote>
                    <p>It is not an exaggeration to say that peas can be described as nothing less than perfect spheres of joy.</p>
                </blockquote>
            </aside>
            <p>The green seed of the white-flowering climbing leguminous papilionaceous plant, pisum sativum, has become a dining-table favourite for good reason.</p>
            <p>The perfect accompaniment to any meal, the diminutive spherical vegetable brings joy to billions worldwide, be they fresh, frozen, canned or dried.</p>
            <p>Even leaving aside the astounding nutritional package, the taste explosion and texture of a well cooked pea is undeniably enough to award this deceptively simple seed the gold-medal of the foodstuff Olympics.</p>
            <p>There is debate surrounding the tampering of the form of the original spherical vegetable. The question as to whether the 'mushy' pea is sacrilege or an innovative approach to re-package the perfect product is a sensitive issue. A similar argument arises when approaching the relatively new craze of mangetout. In-depth study is required, but for now it is too early to assess the true importance of this baby pea pod.</p>
            <p>In its original form, the pea is a giant amongst food products and a deity of the vegetable world. It is not an exaggeration to say that peas can be described as nothing less than perfect spheres of joy.</p>
        </article>
    </body>
    </html>

    따옴표 붙이기 2 : 약간의 스타일 추가

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Pull quotes 2</title>
        <style>
            body {
                font: 13px/1.5 arial, helvetica, sans-serif;
            }   
            article {
                width: 500px;
            }   
            .pquote {
                float: right;
                width: 200px;
                background-image: url("./img/openquote.gif") top left no-repeat;
                color: #030;
                font-size: 26px;
                line-height: 0.9;
                font-style: italic;
                padding: 13px;
            }
            blockquote {
                margin: 0;
            }
            .pquote p:first-letter {
                font-size: 39px;
                font-weight: bold;
            }
        </style>
    </head>
    <body>
        <article>
            <p>If ever there was evidence of God, the humble pea is it.</p>
            <p>Mother Nature has never created something of such perfection, something that takes Darwin's theory of evolution to the extent that a natural element can, over millions of years, evolve into something so flawless.</p>
            <aside class="pquote">
                <blockquote>
                    <p>It is not an exaggeration to say that peas can be described as nothing less than perfect spheres of joy.</p>
                </blockquote>
            </aside>
            <p>The green seed of the white-flowering climbing leguminous papilionaceous plant, pisum sativum, has become a dining-table favourite for good reason.</p>
            <p>The perfect accompaniment to any meal, the diminutive spherical vegetable brings joy to billions worldwide, be they fresh, frozen, canned or dried.</p>
            <p>Even leaving aside the astounding nutritional package, the taste explosion and texture of a well cooked pea is undeniably enough to award this deceptively simple seed the gold-medal of the foodstuff Olympics.</p>
            <p>There is debate surrounding the tampering of the form of the original spherical vegetable. The question as to whether the 'mushy' pea is sacrilege or an innovative approach to re-package the perfect product is a sensitive issue. A similar argument arises when approaching the relatively new craze of mangetout. In-depth study is required, but for now it is too early to assess the true importance of this baby pea pod.</p>
            <p>In its original form, the pea is a giant amongst food products and a deity of the vegetable world. It is not an exaggeration to say that peas can be described as nothing less than perfect spheres of joy.</p>
        </article>
    </body>
    </html>

    인용 부호 3 : 보다 정교한 스타일

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Pull quotes 3</title>
        <style>
            body {
                font: 13px/1.5 arial, helvetica, sans-serif;
            }
            article {
                width: 500px;
            }
            .quotebox {
                float: left;
                width: 200px;
                background-color: #900;
                background-image: url(./img/face-01.jpg) top no-repeat;
                color: #fc0;
                font-size: 12px;
                line-height: 1.2;
                padding-top: 71px;
                border: 2px solid #600;
                margin: 0 12px 12px 0;
            }
            .quotebox p {
                margin: 0;
            }
            .quotebox blockquote {
                font-weight: bold;
                padding: 6px;
                border-top: 2px solid #600;
                margin: 0;
            }
            .quotebox .by {
                padding: 6px;
            }
        </style>
    </head>
    <body>
        <article>
            <p>If ever there was evidence of God, the humble pea is it.</p>
            <p>Mother Nature has never created something of such perfection, something that takes Darwin's theory of evolution to the extent that a natural element can, over millions of years, evolve into something so flawless.</p>
    
            <aside class="quotebox">
                <blockquote>
                    <p>It is my educated opinion that this is complete and utter tosh.</p>
                </blockquote>
                <p class="by">Patrick Griffiths (pea farmer)</p>
            </aside>
    
            <p>The green seed of the white-flowering climbing leguminous papilionaceous plant, pisum sativum, has become a dining-table favourite for good reason.</p>
            <p>The perfect accompaniment to any meal, the diminutive spherical vegetable brings joy to billions worldwide, be they fresh, frozen, canned or dried.</p>
            <p>Even leaving aside the astounding nutritional package, the taste explosion and texture of a well cooked pea is undeniably enough to award this deceptively simple seed the gold-medal of the foodstuff Olympics.</p>
            <p>There is debate surrounding the tampering of the form of the original spherical vegetable. The question as to whether the 'mushy' pea is sacrilege or an innovative approach to re-package the perfect product is a sensitive issue. A similar argument arises when approaching the relatively new craze of mangetout. In-depth study is required, but for now it is too early to assess the true importance of this baby pea pod.</p>
            <p>In its original form, the pea is a giant amongst food products and a deity of the vegetable world. It is not an exaggeration to say that peas can be described as nothing less than perfect spheres of joy.</p>
        </article>
    
    </body>
    </html>
  • CSS 타이포그래피 속성

    CSS 타이포그래피 속성

    HTML의 타이포그래피를 위한 기본 속성은 다음과 같이 구성됩니다.

    글꼴 속성(Font properties)

    font-family – 글꼴
    font-size – 글꼴 크기
    font-weight – 글꼴 굵기
    font-style – 글꼴 스타일
    font-variant – 글꼴 변형

    텍스트 속성(Text properties)

    text-align – 텍스트 정렬
    text-decoration – 텍스트 장식
    text-indent – 텍스트 들여 쓰기
    text-shadow – 텍스트 그림자
    text-transform – 텍스트 변환

    기타 여러 가지(Miscellaneous)

    letter-spacing – 글자 간격
    word-spacing – 단어 간격
    white-space – 화이트 스페이스
    line-height – 행간

    아래의 CSS 예제를 통해 이미지를 상상해 보세요. 그리고 미리 보기로 확인하세요.

    .typography-example-1 {
    	background-image: linear-gradient(135deg, #723362, #9d223c);
        background-color: #9d223c;
        color: #fff;
        padding: 1em 0;
        font-weight: 300;
        font-size: 1.8em;
        text-transform: uppercase;
        text-align: center;
        letter-spacing: .4em;
        padding-left: .4em
    }
    .typography-example-2 {
        background: #fff;
        color: #000;
        border: .5em solid;
        font-size: 1.5em;
        padding: 1em 0;
        text-align: center
    }
    
    .typography-example-2 .title {
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .4em;
        padding-left: .4em
    }
    
    .typography-example-2 .author {
        color: #888;
        font-size: .7em;
        font-weight: 300;
        font-style: italic;
        letter-spacing: .12em;
        padding-left: .12em
    }
    .typography-wrapper {
    	width: 520px;
    }
    .typography-example-3 {
    	border: .2em solid #ff4136;
    	font-size: 3em;
    	text-align: center;
    	padding: .2em;
    	color: #fff
    }
    
    .typography-example-3 span {
    	display: inline-block;
    	width: 15%;
    	padding: .8125rem;
    }
    
    .typography-example-3 span:nth-child(1) { background: #ff4136 }
    .typography-example-3 span:nth-child(2) { background: #ff851b }
    .typography-example-3 span:nth-child(3) { background: #2ecc40 }
    .typography-example-3 span:nth-child(4) { background: #0074d9 }
    .typography-example-3 span:nth-child(5) { background: #b10dc9 }
  • HTML 문서 기본 구조

    HTML 문서 기본 구조

    HTML 문서는 여러 요소(element)들로 구성됩니다. 최상위 요소는 html 요소이며 그 밑에는 head 요소와 body 요소가 나란히 나와야 합니다. 아래의 단순한 예제를 통해 이해를 돕도록 하겠습니다.

    <!DOCTYPE html>
    <html>
    
      <!-- head open -->
      <head>
         <meta charset="utf-8">
         <title>제목</title>
      </head>
      <!-- head close -->
    
      <!-- body open -->
      <body>
         <h1>제목</h1>
         <p>단락</p>
      </body>
      <!-- body close -->
    
    </html>

    기본적으로 HTML 태그는 여는 태그와 닫는 태그로 한 조를 이루는 특징이 있습니다. 간혹 닫는 태그가 없는 경우도 있으니 기억해두기 바랍니다.

    <html> 여는 태그
    </html> 닫는 태그
    <body> 여는 태그
    </body> 닫는 태그
    <h1> 여는 태그
    </h1> 닫는 태그
    <p> 여는 태그
    </p> 닫는 태그

    DTD 선언

    표준 HTML5  문서의 첫 줄에 DTD선언을 해야 합니다. DTD란 문서 형식 정의(Document Type Definition)의 약어입니다.

    <!DOCTYPE html>

    HEAD 태그

    head 태그는 HTML 문서에 대한 메타 데이터이며, 메타 데이터는 표시되지 않습니다.
    메타 데이터는 일반적으로, 문자 집합, 스타일, 링크, 스크립트 및 기타 메타 정보와 문서 제목을 정의합니다.
    메타 데이터 종류 :  <title>, <style>, <meta>, <link>, <script>, and <base>.

    meta 요소는 여러가지 용도로 쓰이는데 아래 예시에서는 이 문서가 utf-8이라는 문자셋으로 저장되어 있음을 나타내는 용도로 쓰였습니다. 문자셋이란 컴퓨터가 글자(한글, 영문 등)를 저장하는 방식을 나타내는데, utf-8은 그 중에서도 다국어로 작성된 문서를 저장할 때 가장 널리 쓰이는 방식입니다.

    <meta charset="utf-8">

    다만 여기서 참고해야 할 것은 닫는 태그가 없는 이유는 meta 요소 안에는 담을 수 있는 내용이 없기 때문입니다.

    문서의 몸체(BODY)

    body 태그는 문서의 모든 보여지는 것을 관장합니다.
    올바른 HTML을 작성하려면 지금까지 살펴본 내용 이외에도 지켜야할 많은 규칙들이 있습니다. 몇 가지 예제를 통해 살펴보도록 하겠습니다.

    <!-- 수식에서의 괄호와 마찬가지로 태그도 여는 태그와 닫는 태그의 쌍이 잘 맞아야 합니다.-->
    <!-- 올바른 예제 -->
    <p>태그를 열고 닫는 <em>순서</em>를 잘 지켜야 합니다</p>
    
    <!-- 잘못된 예제 -->
    <p>태그를 열고 닫는 <em>순서</p>를 잘 지켜야 합니다</em>
    <p>태그를 열고 닫는 <em>순서를 잘 지켜야 합니다</p>

    들여쓰기와 줄바꿈

    HTML 문서를 작성하는 사람이 보기 편하게 하기 위한 것이고 사실은 아래와 같이 들여쓰기를 하지 않아도 상관 없습니다. 모두 한 줄로 붙여서 쓰거나, 줄바꿈을 다른 방식으로 해도 동일한 HTML 문서입니다.
    하지만 HTML 문서가 길고 복잡할수록 줄바꿈과 들여쓰기를 적절히 활용하는 것이 중요해집니다. 그렇지 않으면 읽고 쓰기가 어렵기 때문입니다.

    <!-- 들여쓰기를 무시한 예제 -->
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>제목</title>
    </head>
    <body>
    <h1>제목</h1>
    <p>단락</p>
    </body>
    </html>
    
    <!-- 한줄로 나열한 예제 -->
    <!DOCTYPE html>
    <html>
    <head><meta charset="utf-8"><title>제목</title></head>
    <body><h1>제목</h1><p>단락</p></body>
    </html>
    

    유효성 검사 확인

    HTML의 문법은 생각보다 복잡해서 완전히 외우기 쉽지 않고, 익숙해진 후에도 간혹 실수를 하게 됩니다. 가장 좋은 방법은 유효성 검사 프로그램을 활용하여 자신이 작성한 문서가 표준을 준수하고 있는지에 대하여 검사하는 것입니다. 아래의 순서대로 접근하면 확인 할 수 있습니다.

    1. http://validator.w3.org/ 에 접속합니다.
    2. “Validate by Direct Input”을 클릭합니다.
    3. 작성한 HTML 문서의 전체 텍스트를 복사하여 붙여넣기 합니다.
    4. “Check” 버튼을 클릭합니다.
    5. 화면 상단이 녹색으로 바뀌며 “This document was successfully checked as HTML5!”이라고 나오면 성공입니다. 오류가 있을 경우 화면이 붉은색으로 바뀌고 하단에 어떠한 부분이 문제인지에 대한 상세한 설명이 나옵니다.
  • 맥을 위한 텍스트 편집기 TextMate

    맥을 위한 텍스트 편집기 TextMate

    TextMate2가 오픈소스가 된 이후, 지속적인 변경이 이루어지고 있지만
    TextMate와 같이 괜찮은 책 형태의 문서나 온라인 문서가 없는 것 같아 찾아보던 중
    이곳에서 TextMate2 기본 사용법을 기술해 놓은 것을 찾을 수 있었다.

    일부 내용은 불필요한 것도 있고 해서 기초적인 사용법 중 괜찮은 내용만 번역해 보았다.
    번역이 이상한 부분이나 기술되지 않은 상세한 내용은 원 저자의 페이지를 참조하시길…

    Bundles

    TextMate의 진정한 힘은 Bundle에 있다. 당신이 내가 하는 것처럼 Ruby나 Shell 코드를 작성하든 또는 다른 소수 사용자가 사용하는 언어를 사용하든, 그 언어에 대한 syntax highlighting 뿐만 아니라 프로그래밍을 더욱 쉽게 작성할 수 있게 도와주는 다양한(whole bunch) snippet들을 가지고 있는 bundle을 사용할 수 있을 것이다. 프로그래밍 언어, build system, source code control, 테스팅용 언어, 그리고 여러가지 파일 포맷들에 대한 bundle이 존재한다. 심지어 테마용 bundle도 있다.

    나는 모든 bundle을 한꺼번에 설치하지 않고 내가 필요한 것만 설치한다(그리고 필요하지 않은 것들은 다 지운다). 이러한 식의 무분별한 모든 설치는 TextMate 1이 잘 나가던 시절, 키보드 입력시 충돌을 발생시켰다.

    한 언어용 또는 특정 기능에 대한 bundle을 설치하기 위해서, Preferences… 를 열거나 ⌘,를 누른다 그리고 Bundles 를 누른다. 설치할 bundle의 체크 박스를 클릭하여 체크한다. 지우려면 체크되어 있는 체크 박스를 클릭하여 체크를 해제한다. 아니면 아직 bundle을 설치하지 않은 형식의 파일(an unrecognized file)을 열면 TextMate2가 설치할 bundle을 추천해 줄 것이다.

    Bundle에 어떤 기능이 들어있는지 배우기 위한 방법은 다양하다. Bundle / Edit Bundles… 메뉴를 클릭(또는 ⌃⌥⌘B 단축키 사용)하고 나서 내용을 확인하고 싶은 bundle을 클릭한다. 아니면 사용가능한 bundle을 확인하기 위해 열린 파일의 내용 아래에 보이는 톱니바퀴 메뉴(gear menu)를 클릭해 볼 수도 있다.

    아니면 가장 좋은 방법으로 ⌘⌃T 단축키를 눌러 bundle 검색 창을 띄워 어디에 무엇이 있는지 찾는 방법도 있다. 당신이 존재할 것으로 생각하는 것이나 수행했으면 하는 것을 입력하면 나올 것이다. 이 방식이 내가 매일 사용하는 snippet들과 단축키들을 사용 가능 리스트에서 찾아 쓰는 방식이다.

    Default file

    단축키 ⌘N 은 프로그래머의 친구다. 이 단축키는 모든 에디터에서 새로운 파일을 생성한다. TextMate 2에서, 기본 설정은 프로그래머용 에디터에서 정말로 아무런 의미없는 순수 텍스트 파일(plain text file)을 생성하도록 한다. 나는 내가 대부분의 시간을 보내는 나가 가장 일반적으로 사용하는 파일 형식인 Ruby 포맷을 이 단축키가 생성하도록 하였고 이것이 나에게 필요한 것이다. 기본 파일 타입을 설정하기 위해서, Preferences… 를 열고 Files 탭에서 당신이 선호하는 새로운 문서 타입을 설정하면 된다.
    Favorites

    나는 TextMate2를 사용할 때 동일한 프로젝트를 반복해서 열고 또 여는 것을 알고 있다. TextMate 1은 프로젝트용 파일들이 있었지만 나는 결코 그 파일들을 사용하지 않았다. 그래서 나는 터미널을 열고 프로젝트를 열어 사용하곤 했다. 이를 위해 프로젝트 폴더로 이동해서 mate . 명령을 수행해 프로젝트 폴더를 에디터에서 열었다(그리고 나중에 TextExpander script를 사용하여 이를 수행하도록 하였다. 상세한 것은 TextExpander in Terminal를 참고하라).

    TextMate 2에서, Favorites 기능은 나에게 있어서 더 편리한 기능이다(works better for me). Favorite를 설정하기 위해서는, 프로젝트들에서 사용되고 있는 파일들을 살펴볼 수 있는 파일 브라우저를 이용한다.

    Favorate를 생성하기 위해, 프로젝트 폴더 상에서 오른쪽 마우스를 클릭한 후 “Add <folder> to Favorites”를 선택한다.

    다음부터 Favorate로 지정한 프로젝트를 열기 원하면 ⇧⌘O (숫자 0이 아니라 알파벳 O)를 눌러 Open Favorite 창을 열고 열기 원하는 프로젝트를 클리하거나 입력하면 된다.
    나는 이 기능이 좋다(I just love this). 현재 TextMate 2 알파 버전에서는 favorate를 업데이트하기 위해서는 어플리케이션을 재시작해야만 하니 참고하시길.

    mate and rmate

    하루 대부분의 시간을 shell에서 보내기 때문에 나는 TextMate 2에서 열고 수정하는 많은 파일들에 대해 mate 명령을 이용하여 작업한다. mate 명령을 설치하기 위해서는, Preferences…를 열고 Terminal 탭을 클릭한 후 install을 클릭한다. 그러면 어디서든 파일을 열어 편집하고 싶은 파일에 대해 mate <filename> 명령을 이용할 수 있다. 또한 나는 많은 가상 서버에 있는 파일들을 수정 및 관리하기 위해 ssh 을 사용한다. vi 는 단순한 편집은 정말 잘 해준다. 그러나 나는 내 컴퓨터에서 좀 더 복잡한 편집을 하기 위해 TextMate 2가 원격 머신(remote machine)에서 동작하도록 하기 위해 rmate 명령을 사용한다.

    서버에서 rmate 가 동작하도록 설정하기 위해서는, ssh 을 수행해 서버에 접속한 후 필요하다면 sudo를 이용해야 한다. 다음 명령을 입력해 스크립트를 다운로드하고 실행 권한을 주도록 하자:

    curl -Lo /usr/local/bin/rmate https://raw.github.com/textmate/rmate/master/bin/rmate
    chmod a+x /usr/local/bin/rmate

    rmate 를 수행하기 위해 ssh 연결을 할 때 역방향 tunnel을 생성할 필요가 있다. ~/.ssh/config 파일에 다음과 같은 각각의 원격 서버용 entry를 생성하자:

    Host nimitz
    User hiltmon
    HostName 192.168.xx.xxx
    RemoteForward 52698 localhost:52698

    이제 서버로 ssh 연결을 하고 TextMate 2로 편집을 하기 위해 rmate를 수행하자. 예를 들면:

    local $ ssh nimitz
    nimitz $ rmate .bash_profile

    위와 같이 수행을 하면 로컬에서 TextMate 2를 이용해 원격 서버에 있는 .bash_profile 파일을 열 것이다.

    Muscle memory keys

    한명의 Mac 유저로써, 나는 이미 내 근육 기억(muscle memory)에 Mac에서 사용되는 편집용 단축키들이 기억되어 있다. 여기에 내가 TextMate 2에서 생산성을 최대화하기 위해 늘 사용하는 몇가지 추가적인 단축키들을 제시한다:

    ⌘T 는 내가 가장 좋아하는 단축키로써, 문자열을 입력할 수 있는 Go to File 창을 띄운다. 그리고 TextMate 2는 project에서 사용되고 있는 파일들 중 일치하는 모든 파일들을 찾아준다. 흔한 사용 예는 routes.rb 파일 열기 (⌘T rou ↩) 또는 Rails project들에서 사용하는 schema.rb 파일 열기 이다.

    ⌘R 는 현재 파일을 실행한다. 나는 에디터 윈도우 아래에 실행 결고가 출력되는 기본 설정을 좋아하지 않아, Preferences, Projects 탭에서 New window 에 출력되도록 설정을 변경하였다.
    ⇧⌃D 는 한 라인(또는 현재 선택되어 있는 부분)의 복사본을 생성한다. 나는 코드 패턴들의 복사본을 생성한 후 parameter들만 수정하는데 자주 사용한다. 예를 들어, 다음과 같은 ActiveRecord에 CVS import를 이용해 코드를 넣을 때

    <!-- container -->
    <div class="container">
    <div class="row">
    <header class="twelve columns">
    <p>HEADER</p>
    </header>
    </div>
    </div>
    <!-- container -->
    Security.create!(
    cusp: row[0],
    isin: row[1]

    나는 마지막 라인의 복사본을 반복해서 생성한다.

    Security.create!(
    cusp: row[0],
    isin: row[1]
    isin: row[1]
    isin: row[1]
    isin: row[1]
    isin: row[1]
    isin: row[1]

    그리고나서 아래 화살표 키를 이용해 label과 index를 수정한다.

    ⌥→ 는 다음 단어로 이동(⇧ 는 선택 모드)시킨다 그리고 ⌘→ 는 표준 Mac에서 하는 것과 마찬가지로 라인 끝으로 이동시킨다. 그래서 새로운 것을 배우지 않고도, 파일에서 caret을 더 빨리 이동시킬 수 있다. 하지만 TextMate 2는 여기서 더 나아가, Mission Control에 매핑되어 있지 않은 경우 ⌃→ 키를 누르면 CamelCase 단어의 다음 부분으로 이동합니다(저는 이 기능을 사용하지 않습니다).
    ⌥← 는 이전 단어로 이동(⇧ 는 선택 모드)시킨다 그리고 ⌘← 는 라인 시작으로 이동시킨다.
    ⌘↩ 는 현재 라인 중 어느위치에 커서가 있어도 새로운 라인을 현재 라인 다음에 생성한다. 특히 Textmate auto-inserts 기능은 {나 ‘ 가 열려있을 경우 자동으로 닫아준다(}, ‘를 자동으로 생성해 주는 것을 의미하는 것으로 보임)
    ⌘] 는 현재 라인에 대해 들여쓰기를 수행한다. TextMate2는 입력할 때 주로 이 기능을 수행된다. 그러나 지우기를 할 때는 이 기능이 항상 잘 동작하지는 않는다.
    ⌘[ 는 현재 라인에 대해 역방향 들여쓰기를 수행한다(un-indents).
    ⌘/ 는 현재 라인 전체를 주석으로 변경해 주거나 일반 라인으로 변경해준다. 나는 테스트 하는 경우 또는 디버그를 발견했을 때 디버그용 출력문을 주석처리할 때 이 기능을 많이 사용한다. 여러 라인을 한번에 선택후 주석처리하는 것도 가능하다.
    ⇧⌘] 는 다음 탭으로 이동시킨다. 주로 뷰, 컨트롤러, 헬퍼 사이에 이동할 때 많이 사용된다. 흥미롭게도, Ruby 번들도 이와 같이 이동하는 macro들을 제공하지만 나는 사용하지 않는다.
    ⇧⌘[ 는 이전 탭으로 이동시킨다.

    Column mode

    컬럼모드는 간단히 설명하면, 먼저 컬럼 모드 시작을 원하는 컬럼 위치로 캐럿을 이동 시킨 후 여러 라인을 한꺼번에 선택하되 컬럼모드 마지막으로 선택되기 원하는 커럼에서 선태을 종료한다. 그 후 ⌥ 키를 누르면 컬럼모드가 선택된다. 컬럼모드 선택한 상태에서 ⇧→ 를 입력해 추가 선택을 할 수 있고 ⌥→를 눌러 필드간 이동을 할 수 있다.

    Searching

    다른 모든 에디터들처럼, TextMate도 완전한 검색 및 대치 기능을 지원한다. 나는 파일내 검색 및 대치를 많이 사용하고 뿐만 아니라 project내 검색도 자주 사용해서 관련 단축키들을 암기하고 있다.

    한 파일 내에서 검색 및 이동을 위해 나는 검색에 사용할 단어를 선택하기 위해 ⌘E 를 먼저 누른다. ⌘G는 선택한 패턴이 다음으로 존재하는 위치를 찾고 그 위치로 이동한다. ⇧⌘G 는 이전에 존재하는 위치를 찾는다.

    나는 또 빠른 대치 기능을 사용한다. 찾고자 하는 패턴을 선택한 후 ⌘E 를 누른다. 그리고나서 선택한 패턴을 바꾸고 싶은 새로운 내용으로 변경한다. 변경한 내용을 선택한 후 ⇧⌘E 를 입력해 TextMate에게 새로운 선택항목은 대체할 내용임을 알려준다. 만약 용감하다면 ⌃⌘G 를 입력해 모든 대치하고자 하는 텍스트를 한번에 변경하면 된다.

    만약 항목 선택없이 검색을 시작하고자 한다면, ⌘F 가 당신의 친구가 될 것이다. ⌘F 를 입력해 Find 창을 열고 검색하고자 하는 내용을 입력 후 return을 눌러 검색을 시작한다. 여기서도 ⌘G 과 ⇧⌘G 를 입력해 다음과 이전에 존재하는 항목에 대한 검색을 할 수 있다.

    그리고 project내 모든 파일에 대해 검색을 수행하려면, ⇧⌘F 를 누르면 검색이 project내 모든 파일에 대해 적용될 것이다.