HTML5¼¼Êõ

2017ÄêҪѧϰµÄÈý¸öCSSÐÂÌØÐÔ - Â̵ºÖ®±±

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-01-20 14:01 ÎÒÒªÆÀÂÛ( )

ÕâÊÇ·­ÒëµÄһƪÎÄÕ£¬Ô­ÎÄÊÇ£º3 New CSS Features to Learn in 2017£¬·­ÒëµÄ²»ÊǺܺã¬ÈçÓÐÒÉÎÊ»¶Ó­Ö¸³ö¡£ еÄÒ»Ä꣬ÎÒÃÇÓÐһϵÁÐеĶ«Î÷Ҫѧϰ¡£¾¡¹ÜCSSÓкܶàеÄÌØÐÔ£¬µ«ÓÐÈý¸öÌØÐÔÁîÎÒ×¶¯²¢½øÐÐѧϰ¡£ 1. Feature Queries£¨ÌØÐÔ²éѯ£© ÔÚÕâ֮ǰÎÒд

ÕâÊÇ·­ÒëµÄһƪÎÄÕ£¬Ô­ÎÄÊÇ£º3 New CSS Features to Learn in 2017£¬·­ÒëµÄ²»ÊǺܺã¬ÈçÓÐÒÉÎÊ»¶Ó­Ö¸³ö¡£

еÄÒ»Ä꣬ÎÒÃÇÓÐһϵÁÐеĶ«Î÷Ҫѧϰ¡£¾¡¹ÜCSSÓкܶàеÄÌØÐÔ£¬µ«ÓÐÈý¸öÌØÐÔÁîÎÒ×¶¯²¢½øÐÐѧϰ¡£

1. Feature Queries£¨ÌØÐÔ²éѯ£©

ÔÚÕâ֮ǰÎÒдÁËһƪ¹ØÓÚFeature QueriesµÄÎÄÕÂthe one CSS feature I really want¡£ÏÖÔÚ£¬ËüÒѾ­ÔÚÕâÀïÁË£¡Ä¿Ç°ËùÓÐÖ÷Á÷ä¯ÀÀÆ÷¶¼Ö§³ÖÌØÕ÷²éѯ£¨°üÀ¨Opera Mini£©£¬IEä¯ÀÀÆ÷³ýÍâ¡£

£¬Ê¹ÓÃ@supports¹æÔò£¬ÔÊÐíÎÒÃÇÔÚËüµÄÌõ¼þÇøÓòÄÚдÈëCSS¹æÔò£¬Ö»Óе±µ±Ç°µÄÓû§ä¯ÀÀÆ÷Ö§³Öij¸öCSSÊôÐÔ-Öµ¶ÔµÄʱºò£¬¸ÃCSS´úÂë¿é²Å»áÉúЧ¡£

¾ÙÒ»¸ö¼òµ¥µÄÀý×Ó£¬ÏÂÃæµÄ´úÂëÖУ¬Ö»Óе±ä¯ÀÀÆ÷Ö§³Ödisplay: flexµÄʱºò²Å»áÓ¦ÓÃFlexboxÑùʽ¡£

@supports ( displayflex; } }

ÁíÍâÒ²¿ÉÒÔʹÓÃһЩ²Ù×÷·û£¬±ÈÈçandÓënot£¬ÎÒÃǾͿÉÒÔ´´½¨¸ü¸´ÔÓµÄÌØÕ÷²éѯ¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔʶ±ðÒ»¸öä¯ÀÀÆ÷ÊÇ·ñÖ§³ÖÀÏ°æ±¾µÄFlexboxÓï·¨¡£

@supports ( displayflexbox; } }

ä¯ÀÀÆ÷Ö§³Ö ÍØÕ¹

Feature QueriesͬÑùÖ§³ÖJavascript½Ó¿Ú£ºCSS.supports()£¬Í¬ÑùʹÓÃÉÏÃæµÄÀý×Ó£¬¿´ÏÂÈçºÎʹÓãº

if ( CSS.supports( '(display: flex)') ) { console.log('Ö§³Öflex') .log('²»Ö§³Öflex') .log('Ö§³Öflexbox') .log('²»Ö§³Öflexbox') }

2. Grid Layout£¨Õ¤¸ñ²¼¾Ö£©

CSSÕ¤¸ñ²¼¾ÖÄ£¿é¶¨ÒåÁËÒ»¸ö´´½¨ÒÔÍø¸ñΪ»ù´¡µÄ²¼¾Öϵͳ¡£ÕâºÍµ¯ÐԺв¼¾ÖÄ£¿éÏàËÆ£¬µ«Õ¤¸ñ²¼¾ÖÊÇרÃÅΪҳÃæ²¼¾ÖÉè¼Æ£¬Òò´ËÓкܶ಻ͬµÄÌØÐÔ¡£

Explicit Item Placement

Ò»¸öÕ¤¸ñϵͳÊÇÓÉÕ¤¸ñÈÝÆ÷£¨Grid Containe£¬ÓÉdisplay: grid´´½¨£©¡¢Õ¤¸ñÏGrid Item£©×é³É¡£ÔÚÎÒÃǵÄCSSÖУ¬ÎÒÃÇ¿ÉÒÔºÜÈÝÒ×ÇÒÃ÷È·µÄ×éÖ¯²¼¾ÖÒÔ¼°Õ¤¸ñÏîµÄ˳Ðò¡¢Óë±ê¼ÇÖеIJ¼¾ÖÏà¶ÀÁ¢¡£

ÀýÈ磬ÎÒÔÚÓÃCSSÕ¤¸ñ½øÐÐÊ¥±­²¼¾ÖÒ»ÎÄÖÐÈçºÎʹÓÃÕ¤¸ñ²¼¾ÖÄ£¿é´´½¨Ê¥±­²¼¾Ö¡£

Holy_Grail_CSS_Grid

Ö÷ÒªµÄHTML´úÂ룺

TitleContentMenuAdsFooter</footer> </body>

Ö÷ÒªµÄCSS´úÂ룺

headerfootermainnavigationadsgridfr fr fr

Áé»îµÄ³¤¶È

CSSÕ¤¸ñÄ£¿é½éÉÜÁËÒ»¸öеij¤¶Èµ¥Î»£ºfrµ¥Ôª£¬Ëü±íʾÔÚÕ¤¸ñÈÝÆ÷ÖÐÊ£ÓàµÄ¿Õ¼ä²¿·Ö¡£

ÎÒÃǾͿÉÒÔͨ¹ýÕ¤¸ñÈÝÆ÷µÄ¿ÉÓÿռäÀ´·ÖÅäÕ¤¸ñÏîµÄ¸ß¶ÈÓë¿í¶È¡£ÀýÈ磬ÔÚÊ¥±­²¼¾ÖÖУ¬ÎÒÏëÈÃmainÈÝÆ÷Õ¼Âú³ýÁ½±ßÈÝÆ÷Ö®ÍâµÄËùÓпռ䣬ΪÁËʵÏÖÕâ¸öЧ¹û£¬Ö»ÐèдÈçÏÂÒ»¾ä´úÂ룺

fr

ÔªËؼä¼ä¸ô

ÎÒÃÇ¿ÉÒÔרÃŶ¨ÒåÕ¤¸ñ²¼¾ÖÖÐÔªËؼäµÄ¿Õ϶£¬grid-row-gap¡¢grid-column-gapÒÔ¼°grid-gapÊôÐÔ¿ÉÒÔÍê³ÉÕâÏ×÷£¬ÕâЩÊôÐÔ½ÓÊÜÒ»¸ö<length-percentage>°Ù·Ö±ÈÊý¾ÝÀàÐÍ×÷Ϊֵ£¬ÓëÄÚÈÝÇøÓòµÄ³ß´ç¶ÔÓ¦µÄ°Ù·Ö±È¡£

ÀýÈ磬ÓÐ5%µÄ¿Õ϶£¬¿ÉÒÔÕâÑùд£º

grid

ä¯ÀÀÆ÷Ö§³Ö

CSSÍø¸ñÄ£¿é½«×îÔçÔÚ½ñÄêÈýÔÂÔÚä¯ÀÀÆ÷ÖпÉÓã¨ÌṩĬÈÏÖ§³Ö£©¡£

ÏÖÔÚÏëÌåÑéÔõô°ì£¿

²Î¿¼ÎÒµÄÕâƪ¼Ç¼£º¸÷¸öä¯ÀÀÆ÷¿ªÆôCSS Grid LayoutµÄ·½Ê½¡£

3¡¢Native Variables

×îºóÒ»¸öÊDZ¾µØCSS±äÁ¿¡£¸ÃÄ£¿é½éÉÜÁË´´½¨Óû§×Ô¶¨Òå±äÁ¿µÄ·½·¨£¬¿ÉÒÔ¸øÒ»¸öCSSÊôÐÔ·ÖÅäÒ»¸ö±äÁ¿¡£

ÀýÈ磬Èç¹ûÎÒÓÐÒ»¸öÖ÷ÌâÉ«£¬Õâ¸öÖ÷ÌâÉ«±»ÓÃÔÚÁ˺ü¸¸öµØ·½£¬Õâʱºò£¬¾Í¿ÉÒÔ³éÏóÕâ¸öÖ÷ÌâÉ«µ½Ò»¸ö±äÁ¿ÖУ¬²¢ÇÒÔÚʹÓõÄʱºòÒýÓÃÕâ¸ö±äÁ¿£¬ÕâÑù±È°ÑÕâ¸öÑÕɫдµ½¶à¸öµØ·½¸üÈÝÒ×ά»¤¡£

cornflowerblue; } h1 a strong

ÕâÖÖЧ¹ûÔÚ֮ǰÎÒÃÇÒ»°ã½èÖúCSSÔ¤´¦ÀíÆ÷À´ÊµÏÖ£¬±ÈÈçSASS£¬µ«ÊÇCSS±äÁ¿ÓиöÓŵã¾ÍÊÇÒ»Ö±´æÔÚÓÚä¯ÀÀÆ÷ÖС£ÕâÒâζ×ÅÕâЩ±äÁ¿Öµ¿ÉÒÔÔÚÏßÐ޸ġ£ÀýÈ磬ΪÁ˸üÐÂ--theme-colourÊôÐÔÖµ£¬¿ÉÒÔͨ¹ýÈçÏ·½Ê½£º

.);

ä¯ÀÀÆ÷Ö§³Ö

2017ÄêʲôCSSÌØÐÔ×îÈÃÄ㼤¶¯£¿


¡¡

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

Ïà¹ØÎÄÕÂ
  • React Nativeѧϰ±Ê¼Ç - ÓôúÂë×öµãɶ

    React Nativeѧϰ±Ê¼Ç - ÓôúÂë×öµãɶ

    2016-12-22 16:00

  • Bootstrap ÎÒµÄѧϰ¼Ç¼4 ÂÖ²¥Í¼µÄʹÓúÍÀí½â - À˼£ìáÌìÑÄ

    Bootstrap ÎÒµÄѧϰ¼Ç¼4 ÂÖ²¥Í¼µÄʹÓúÍÀí½â - À˼£ìáÌìÑÄ

    2016-12-17 10:01

  • Bootstrap ÎÒµÄѧϰ¼Ç¼3 µ¼º½ÌõÀí½â - À˼£ìáÌìÑÄ

    Bootstrap ÎÒµÄѧϰ¼Ç¼3 µ¼º½ÌõÀí½â - À˼£ìáÌìÑÄ

    2016-12-17 10:00

  • Bootstrap ÎÒµÄѧϰ¼Ç¼2 Õ¤¸ñϵͳ³õʶ - À˼£ìáÌìÑÄ

    Bootstrap ÎÒµÄѧϰ¼Ç¼2 Õ¤¸ñϵͳ³õʶ - À˼£ìáÌìÑÄ

    2016-12-14 12:01

ÍøÓѵãÆÀ
¾