HTML5¼¼Êõ

CSSÇå³ý¸¡¶¯ - ¶ÎÖñ¾ý

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

CSSÇå³þ¸¡¶¯·½·¨1.¸ø¸¸¼¶Ò»¸öheightÊôÐÔ .div1 .div2 .left .right LeftRight div2 Ô­Àí£º¸¸¼¶ÊÖ¶¯¶¨ÒåÒ»¸ö¸ß¶È£¬¾Í½â¾öÁ˸¸¼¶divÎÞ·¨×Ô¶¯»ñÈ¡µ½¸ß¶ÈµÄÎÊÌâ Óŵ㣺¼òµ¥£¬´úÂëÁ¿ÉÙ¡£ ȱµã£ºÖ»Êʺϸ߶ȹ̶¨²¼¾Ö£¬Òª¸ø³ö¾«È·¸ß¶È¡£ 2.½áβ¼ÓÒ»¸ö¿Õdiv±êÇ©£¬¸ø¿Õd

CSSÇå³þ¸¡¶¯·½·¨ 1.¸ø¸¸¼¶Ò»¸öheightÊôÐÔ

.div1 .div2 .left .rightLeftRight div2

Ô­Àí£º¸¸¼¶ÊÖ¶¯¶¨ÒåÒ»¸ö¸ß¶È£¬¾Í½â¾öÁ˸¸¼¶divÎÞ·¨×Ô¶¯»ñÈ¡µ½¸ß¶ÈµÄÎÊÌâ

Óŵ㣺¼òµ¥£¬´úÂëÁ¿ÉÙ¡£

ȱµã£ºÖ»Êʺϸ߶ȹ̶¨²¼¾Ö£¬Òª¸ø³ö¾«È·¸ß¶È¡£

2.½áβ¼ÓÒ»¸ö¿Õdiv±êÇ©£¬¸ø¿Õdiv  clear£ºbothÊôÐÔ

.div1 .div2 .left .right .div --*Çå³þ¸¡¶¯ÓõĿÕdiv*-- LeftRight div2

Ô­Àí£ºÇ°¼ÓÒ»¸ö¿ÕµÄdiv£¬ÀûÓÃclear£ºbothÇå³ý¸¡¶¯

Óе㣺¼òµ¥£¬´úÂëÁ¿ÉÙ£¬ä¯ÀÀÆ÷Ö§³ÖºÃ

ȱµã£º²»ÈÝÒ×Àí½â£¬²»ÀûÓÚ²¼¾Ö

3.¸ø¸¸¼¶¶¨ÒåÒ»¸öαÀࣺafter

.div1{ border background-color .div1:after{ content clear display .left{ width height float background-color .right{ width height float background-color .div2{ background-color border

Ô­Àí£ºÏ൱ÓÚ¸ø¸¸¼¶¼ÓÒ»¸ö×Ó¼¶£¨¿ÕµÄdiv£¬¸øclear£ºbothÊôÐÔ£¬²¢ÇÒcontent±ØÐëÓУ¬¾¡¹ÜÄÚÈÝΪ¿ÕÒ²µÃд£©

Óŵ㣺ä¯ÀÀÆ÷Ö§³ÖÐк㬲»ÈÝÒ׳öÏÖ¹ÖÎÊÌâ¡£

ȱµã£º´úÂë¶à£¬²»ÈÝÒ×±»³õѧÕßÀí½â

4.¸ø¸¸¼¶¶¨Òå  overflow:hidden

.div1{ border background-color overflow .left{ width height float background-color .right{ width height float background-color .div2{ background-color border

Ô­Àí£º±ØÐ붨Òå¿í¶È£¬Í¬Ê±²»Äܶ¨Òå¸ß¶È£¬Ê¹ÓÃover£ºhiddenä¯ÀÀÆ÷×Ô¶¯¼ì²â¸¡¶¯ÔªËصĸ߶È

Óŵ㣺´úÂëÁ¿ÉÙ

ȱµã£ºÈç¹û×Ó¼¶Îª¶¨Î»ÔªËØ£¬¶øÇÒ×Ó¼¶¿í¶È´óÓÚ¸¸¼¶Ê±£¬¶àÓàµÄÄÚÈݻᱻÒþ²Ø

5.¸ø¸¸¼¶¶¨Òå  overflow:auto

.div1{ border background-color overflow .left{ width height float background-color .right{ width height float background-color .div2{ background-color border

Ô­Àí£º±ØÐ붨Òå¿í¶È£¬Í¬Ê±²»Äܶ¨Òå¸ß¶È£¬Ê¹ÓÃover£ºautoä¯ÀÀÆ÷×Ô¶¯¼ì²â¸¡¶¯ÔªËصĸ߶È

Óŵ㣺´úÂëÁ¿ÉÙ

ȱµã£ºÈç¹û×Ó¼¶¿í¶È´óÓÚ¸¸¼¶Ê±£¬¶àÓàµÄÄÚÈݻᱻÒþ²Ø

 

¡¡

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

Ïà¹ØÎÄÕÂ
  • float¸¡¶¯ÒýÆðµÄul¸ß¶È±ÀÀ£ÓëoverflowµÄ¹Øϵ - ½£ÎÞ·æ

    float¸¡¶¯ÒýÆðµÄul¸ß¶È±ÀÀ£ÓëoverflowµÄ¹Øϵ - ½£ÎÞ·æ

    2015-11-24 08:05

  • 2.ÉîÈëÀí½â¸¡¶¯ºÍ¶¨Î» - Ò×ÌìêØСÅèÓÑ

    2.ÉîÈëÀí½â¸¡¶¯ºÍ¶¨Î» - Ò×ÌìêØСÅèÓÑ

    2015-11-22 10:24

  • HTML½Ì³Ì£º×¢ÊÍ´úÂëÒýÆðIE6¸¡¶¯µÄbug_HTML½Ì³Ì

    HTML½Ì³Ì£º×¢ÊÍ´úÂëÒýÆðIE6¸¡¶¯µÄbug_HTML½Ì³Ì

    2015-09-24 19:05

  • HTMLÖÐÎÄ×ÖˮӡµÄÇå³ý·½·¨_HTML½Ì³Ì

    HTMLÖÐÎÄ×ÖˮӡµÄÇå³ý·½·¨_HTML½Ì³Ì

    2015-09-23 11:02

ÍøÓѵãÆÀ
½