css3¼¼Êõ

CSS Sprites + Ô²½Ç_div+css½Ì³Ì(2)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2015-09-20 10:47 ÎÒÒªÆÀÂÛ( )

Ö®ºó£¬Í¨¹ý¶¨Òå .corner ÀàÀ´Ð­ÖúÔ²ÐκÐÄ£ÐÍÔØÈë Sprite Ñùʽ: #type1 {background-color:#CCDEDE;} #type1 .corner {background-image:url(../images/corners-type1.gif);} ºÃÁË£¬ÎÒÃǵĵÚÒ»¸öÔ²½Ç¾ØÐδ󹦸æ³ÉÁË

Rounded Box Type 1 Background Hexa Color

Ö®ºó£¬Í¨¹ý¶¨Òå .corner ÀàÀ´Ð­ÖúÔ²ÐκÐÄ£ÐÍÔØÈë Sprite Ñùʽ:

#type1 {background-color:#CCDEDE;}
#type1 .corner {background-image:url(../images/corners-type1.gif);}

Corner Type 1 Sprite

ºÃÁË£¬ÎÒÃǵĵÚÒ»¸öÔ²½Ç¾ØÐδ󹦸æ³ÉÁË£¡Ô¤ÀÀÔ²½Ç¾ØÐÎÄ£ÐÍ1 (À¶É«)

Ô²ÐκÐÄ£ÐÍ 2 (ÂÌÉ«) / Ô²ÐκÐÄ£ÐÍ 3 (×ÏÉ«)

Ä£ÐÍ1£¬Ä£ÐÍ2¸úÄ£ÐÍ3µÄΨһ²î±ð¾ÍÊÇËüÃǵÄÑÕÉ«£¬ËùÒÔÎÒÃÇÒ²½ö½öÖ»ÐÞ¸ÄÕâЩ¡£

Ä£ÐÍ 2 (ÂÌÉ«)

HTML ´úÂ룺

<div class="roundedBox" id="type2">
<strong>My content in roundedBox Type 2</strong>

<div class="corner topLeft"></div>
<div class="corner topRight"></div>
<div class="corner bottomLeft"></div>
<div class="corner bottomRight"></div>
</div>

CSS ´úÂë (½ö½öÐÞ¸Ä sprites µÄÑÕÉ«¼°±³¾°É«)

Corner Type 2 Sprite

#type2 {background-color:#CDDFCA;}
#type2 .corner {background-image:url(../images/corners-type2.gif);}

Ô¤ÀÀÔ²½Ç¾ØÐÎÄ£ÐÍ2 (ÂÌÉ«)

Ä£ÐÍ 3 (×ÏÉ«)

HTML ´úÂ룺

<div class="roundedBox" id="type3">
<strong>My content in roundedBox Type 3</strong>
<div class="corner topLeft"></div>

<div class="corner topRight"></div>
<div class="corner bottomLeft"></div>
<div class="corner bottomRight"></div>
</div>

CSS ´úÂë (½ö½öÐÞ¸Ä sprites µÄÑÕÉ«¼°±³¾°É«)

Corner Type 3 Sprite

#type3 {background-color:#D3CADF;}
#type3 .corner {background-image:url(../images/corners-type3.gif);}

Ô¤ÀÀÔ²½Ç¾ØÐÎÄ£ÐÍ 3 (×ÏÉ«). ¶¼Ñ§»áÁËÂ𣿺ã¬ÏÖÔÚÎÒÃÇÔÙ½øÒ»²½Ñ§Ï°¡£Ä£ÐÍ 4 (ºìÉ«±ß¿ò)

Ä£ÐÍ4 ¸úÄ£ÐÍ1¡¢2¡¢3ÓÖÓÐʲôÇø±ðÄØ£¿±ß¿òºÍÑÕÉ«£¬ÈÃÎÒÃÇÀ´½â¾öÕâЩÒòËØ°É¡£

HTML ´úÂ룺

<div class="roundedBox" id="type4">
<strong>My content in roundedBox Type 4</strong>
<div class="corner topLeft"></div>

<div class="corner topRight"></div>
<div class="corner bottomLeft"></div>
<div class="corner bottomRight"></div>
</div>

CSS ´úÂë (ÔÚ sprite ÖиøÄúµÄ±ß½ÇµÄ±ß¿ò¶¼ÌíÉϱ߿ò£¬²¢Ê¹ .roundedBox ÀàµÄ±³¾°¼°±ß¿òÈÚºÏ sprite¡£)

Rounded Box Type 4 Background and border Hexa Color

#type4 {background-color:#CCACAE; border:1px solid #AD9396;}
#type4 .corner {background-image:url(../images/corners-type4.gif);}

Corner Type 4 Sprite

ºÃÁË£¬Õâ¸ö¾ÍÊǽØͼЧ¹û¡£ÎÒÃǵı߽ǻ¹²»ÄÜÕýÈ·µØ¸²¸Ç #type4 ±ß¿ò¡£ËùÒÔÎÒÃDZØÐë½ÃÕýËüÃǵĶ¨Î»À´¸²¸ÇÔçÆڵĶ¨Î»Ñùʽ¡£ÈÃÎÒÃÇ×öµ½ÕâÒ»µã:

#type4 {background-color:#CCACAE; border:1px solid #AD9396;}
#type4 .corner {background-image:url(../images/corners-type4.gif);}
#type4 .topLeft {top:-1px;left:-1px;}
#type4 .topRight {top:-1px; right:-1px;}
#type4 .bottomLeft {bottom:-1px; left:-1px;}
#type4 .bottomRight {bottom:-1px; right:-1px;}

ºÃÁË£¬Õâ¾ÍÊÇÎÒÃÇÍê³ÉµÄÄ£ÐÍ 4¡£Ô¤ÀÀÔ²½Ç¾ØÐÎÄ£ÐÍ4 (ºìÉ«±ß¿ò). We are almost there, don’t quit now :pÄ£ÐÍ

5 (´¹Ö±½¥±ä)

ºÃÁË£¬Ä£ÐÍ5»áÐèÒª¸ü¶àµÄ¹¤×÷Á¿£¬ÎÒÃÇÓ¦¸ÃÕâÑù:

ÈÃÎÒÃÇ¿ªÊ¼°É¡£

HTML ´úÂë (¸ú֮ǰµÄÒ»Ñù)£º

<div class="roundedBox" id="type5">
<strong>My content in roundedBox Type 5</strong>
<div class="corner topLeft"></div>
<div class="corner topRight"></div>

<div class="corner bottomLeft"></div>
<div class="corner bottomRight"></div>
</div>

CSS ´úÂ룺

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
ÍøÓѵãÆÀ
¦