 |
|
|  |
½ºÅ¸ÀÏ ½ÃÆ®¸¦ °æ·®ÈÇÏ´Â 11°¡Áö ÆÁ |
|
|
 |
14³â Àü |
Tip #1: »ö»ó °ªÀ» ª°Ô ¾²±â
»ö»óÀ» ÁöÁ¤ÇÏ´Â ¼Ó¼º¿¡ °ªÀ» ±âÀÔÇÒ ¶§ °¡´ÉÇÏ¸é °¡Àå ªÀº °ªÀ» »ç¿ëÇÕ´Ï´Ù.
article { background-color: rgb(255,255,255); } /* WTF? */
article { background-color: #ffffff; } /* better */
article { background-color: #fff; } /* good */
Tip #2: Áߺ¹µÇ´Â ¼Ó¼ºÀ» º´ÇÕÇϱâ
¹Ýº¹ÀûÀ¸·Î Áߺ¹µÇ´Â ¼Ó¼ºµéÀº ÅëÇÕÇÕ´Ï´Ù. ÀÌ ÀÛ¾÷À» ÀÚµ¿À¸·Î ó¸®ÇØ ÁÖ´Â ¿Â¶óÀÎ CSS ÃÖÀûÈ ¼ºñ½ºµµ ÀÖÀ¸´Ï Âü°íÇϼ¼¿ä.
/* before */
#wrap p {
font-family: Georgia, serif;
font-weight: normal;
line-height: 1.33em;
font-size: 1.22em;
}
.
.
.
p {
font-family: Georgia, serif;
font-weight: normal;
line-height: 1.33em;
font-size: 1.33em;
}
/* after */
p {
font-family: Georgia, serif;
font-weight: normal;
line-height: 1.33em;
font-size: 1.33em;
}
Tip #3: °¡´ÉÇÑ ÇÑ ¸ô¾Æ¾²±â
CSS ¼Ó¼ºµé Áß¿¡´Â ¿©·¯ °ªÀ» ÀνÄÇÏ´Â °ÍµéÀÌ ÀÖ½À´Ï´Ù. font³ª background, padding, border µîÀÌ ±×·¸½À´Ï´Ù. ÀÌ·± °æ¿ì ÇÑÁÙ·Î ¸ô¾Æ¾¹´Ï´Ù.
/* before */
p {
font-family: Georgia, serif;
font-weight: normal;
line-height: 1.33em;
font-size: 1.33em;
}
/* after */
p {
font: normal 1.33em/1.33 Georgia, serif;
}
/* these 4 properties */
background-color: #fff;
background-image: url(i/dope.png);
background-repeat: repeat-x;
background-position: 0 0;
/* can be written as */
background: #fff url(i/dope.png) repeat-x 0 0;
/* these 4 properties */
margin-top: 10px;
margin-right: 20px;
margin-bottom: 10px;
margin-left: 20px;
/* can be written as */
margin: 10px 20px 10px 20px;
/* these 3 properties */
border-width: 1px;
border-style: solid;
border-color: red;
/* can be written as */
border: 1px solid red;
Tip #4: °°Àº °ªÀº °áÇÕÇϱâ
padding ȤÀº margin ¼Ó¼ºÀÇ °ªÀÌ µ¿ÀÏÇÑ °æ¿ì ÅëÇÕÇÏ¿© ÁöÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
/* before */
margin: 10px 20px 10px 20px;
padding: 10px 10px 10px 10px;
/* after */
margin: 10px 20px;
padding: 10px;
Tip #5: ºÒÇÊ¿äÇÑ "0"Àº »ý·«Çϱâ
¼Ò¼öÁ¡ ÀÌÇÏÀÇ ¼ö¸¦ »ç¿ëÇϰųª ¹«ÀǸ¶ÇÑ "0"Àº »ý·«ÇÒ ¼ö ÀÖ½À´Ï´Ù.
/* before */
padding: 0.1em;
margin: 10.0em;
/* after */
padding: .1em;
margin: 10em;
Tip #6: °ªÀÌ "0"ÀÌ¸é ´ÜÀ§ »ý·«Çϱâ
°ªÀÇ Å©±â°¡ 0À̶ó¸é ´ÜÀ§´Â »ý·«Çصµ ¹«¹æÇÕ´Ï´Ù.
/* before */
padding: 0px;
margin: 0em;
/* before */
padding: 0;
margin: 0;
Tip #7: ¸¶Áö¸· ¼¼¹ÌÄÝ·Ð »ý·«Çϱâ
¼Ó¼º ±âÀÔÀÌ ³¡³ª´Â ¸¶Áö¸·ÀÇ ¼¼¹ÌÄÝ·Ð(;)Àº »ý·«Çصµ ¹«¹æÇÕ´Ï´Ù.
/* before*/
p {
font-family: Georgia, serif;
font-weight: normal;
line-height: 1.33em;
font-size: 1.33em;
}
/* after */
p {
font-family: Georgia, serif;
font-weight: normal;
line-height: 1.33em;
font-size: 1.33em
}
/* optimized */
p { font: normal 1.33em/1.33 Georgia, serif }
Tip #8: ¹èÆ÷Çϱâ Àü ÄÚ¸àÆ® Á¦°ÅÇϱâ
ÀÛ¾÷°úÁ¤¿¡¼ ÁÖ¼®À» »ç¿ëÇÏ´Â °ÍÀº ºÐ¸í µµ¿òÀÌ µÇ°í Çù¾÷¿¡µµ À¯¸®ÇÕ´Ï´Ù. ±×·¯³ª »ç¿ëÀÚ¿¡°Ô´Â 100% ºÒÇÊ¿äÇÑ µ¥ÀÌÅÍÀÌ¸ç ¹«ÀǹÌÇÑ ¼¹öÀÚ¿ø°ú ´ë¿ªÆøÀ» ¼ÒºñÇϹǷΠ¹èÆ÷Çϱâ Àü¿¡´Â ¹Ýµå½Ã ÄÚ¸àÆ®¸¦ Á¦°ÅÇϵµ·Ï ÇÕ´Ï´Ù.
Tip #9: °ø¹é Á¦°ÅÇϱâ
°ªÀ» ±¸ºÐÇϱâ À§ÇÑ °ø¹éÀ» Á¦¿ÜÇÑ ³ª¸ÓÁö ºó °ø°£Àº ¸ðµÎ Á¦°ÅÇÕ´Ï´Ù.
/* before */
body {
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
background-color: #333;
text-align: center;
margin: 0px auto;
font-size: 62.5%;
color: #FFF;
}
/* after */
body{font-family:"Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-align:center;background:#333;margin:0px auto;font-size:62.5%;color:#fff}
Tip #10: ÁÙ¹Ù²Þ Á¦°ÅÇϱâ
È¿À²ÀûÀÎ °ü¸®¸¦ À§ÇØ ÅÇ(¶Ç´Â °ø¹é) ±×¸®°í ÁٹٲÞÀ» »èÁ¦ÇÕ´Ï´Ù. ½Ì±Û-¶óÀÎ Æ÷¸äÀ¸·Î ÀÛ¼ºÇÏ´Â °ÍÀÌ ¹ÌÄ£ÁþÀ¸·Î º¸ÀÏÁö ¸ð¸£°ÚÁö¸¸ ÀÇ¿Ü·Î ½Ç¿ëÀûÀÎ ÀÛ¼º¹ýÀÔ´Ï´Ù. ¼º´É Çâ»óÀ» ²ÒÇϸ鼵µ ½ºÅ©·ÑÀ» ÁÙÀÏ ¼ö ÀÖ°í ÇÁ·ÎÆÛƼ ´ÜÀ§ µð¹ö±ëÀÌ °¡´ÉÇϱ⠶§¹®ÀÔ´Ï´Ù.
/* before */
hr {
margin: 25px 0 25px 0;
background: #CF7400;
text-align: left;
padding: 15px 0;
display: block;
border: 0 none;
color: #CF7400;
height: 1px;
clear: both;
width: 96%;
}
acronym, abbr {
border-bottom: 1px dotted #514031;
cursor: help;
}
ins { text-decoration: underline; }
del { text-decoration: line-through; }
sup {
font-size: 10px;
line-height: 0;
color: #cccc99;
}
em { font-style: italic; }
small { font-size: 10px; }
strong { font-weight: bold; }
strong:target, h3:target, h4:target {
background: #CF7400;
padding-left: 25px;
}
code, kbd, samp, tt, var {
font-family: "Courier New", Courier, monospace, sans-serif;
color: #cccc99; /* #cc9933 #cccc66 #cccc99 */
font-size: 11px;
}
h3 code { font-size: 13px; }
pre {
border-left: 1px solid #CF7400;
padding: 10px 0 12px 10px;
background: #3B2E22;
overflow: auto;
margin: 25px 0;
width: 525px; /* 95% of 555px = 525px */
}
pre:hover {
border-left: 1px solid #FFFFCC;
background: #3B2E22;
}
/* after */
hr { background:#CF7400;margin:25px 0;text-align:left;padding:15px 0;display:block;border:0 none;color:#CF7400;height:1px;clear:both;width:96%; }
acronym,abbr { border-bottom:1px dotted #514031;cursor:help; }
ins { text-decoration:underline; }
del { text-decoration:line-through; }
sup { font-size:10px;line-height:0;color:#cc9; }
em { font-style:italic; }
small { font-size:10px; }
strong { font-weight:bold; }
strong:target,h3:target,h4:target { background:#CF7400;padding-left:25px; }
code,kbd,samp,tt,var { font-family:"Courier New",Courier,monospace,sans-serif;color:#cc9;font-size:11px; }
h3 code { font-size:13px; }
pre { border-left:1px solid #CF7400;padding:10px 0 12px 10px;background:#3B2E22;overflow:auto;margin:25px 0;width:525px; }
pre:hover { border-left:1px solid #FFC;background:#3B2E22; }
Tip #11: CSS À¯È¿¼º °Ë»çÇϱâ
³¡À¸·Î, W3C¿¡¼ Á¦°øÇÏ´Â CSS À¯È¿¼º °Ë»ç±â¸¦ ÀÌ¿ëÇÏ¿© ¿À·ù°¡ ÀÖ´ÂÁö¸¦ °ËÅäÇϼ¼¿ä. ´ç½ÅÀÌ ³õÃÆÀ» ¼öµµ ÀÖ´Â Àâ´ÙÇÑ ¿À·ùµéÀ» ºü¸£°Ô ã¾ÆÁÝ´Ï´Ù.
Bonus Tips: º¸³Ê½º ÆÁµé
ÀÌ °Ô½Ã¹°À» ÀÛ¼ºÇÏ´Â µ¿¾È ¸î °¡Áö ´Ù¸¥ ¾ÆÀ̵ð¾î°¡ ¶°¿Ã¶ú½À´Ï´Ù.
a:link, a:visited {} /* before */
a:link,a:visited{} /* after */
/* before */
h1{color:#111}
h2{color:#333}
h3{color:#777}
/* after */
h1{color:#111}h2{color:#333}h3{color:#777}
À§¿¡¼ ¾ð±ÞÇÑ ÆÁµé Áß¿¡´Â ÀÚµ¿À¸·Î ó¸®ÇÒ ¼ö ÀÖ´Â °ÍµéÀÌ ÀÖ½À´Ï´Ù. ¿Â¶óÀÎ µµ±¸¸¦ »ç¿ëÇϰųª ¼ºñ½º ºôµå°úÁ¤¿¡ Æ÷ÇÔÇÏ¿© ÀÚµ¿È ÇÒ ¼öµµ ÀÖ´Ù´Â »ç½ÇÀ» ÀØÁö ¸¶¼¼¿ä. ±×¸®°í ±Ô¸ð°¡ Å« ÇÁ·ÎÁ§Æ®´Â ¹èÆ÷/°³¹ß ¹öÀüÀ» ±¸ºÐÇؼ °ü¸®ÇÏ´Â °ÍÀÌ °¡Àå È¿À²ÀûÀÔ´Ï´Ù |
|
̵̧ : 381 |
̵̧
¸ñ·Ï
|
|
|  |
|