๐Ÿ”นdisplay

โ•ฑ๐Ÿšง under construction -> flow/writing direction

CSS โŸฉ layout โŸฉ display

  • block๏ผš

    • ้ ่จญไฝ”ๆ“šๆ‰€ๆœ‰ๅฏฌๅบฆ (width = 100%)ใ€‚

    • ไฝ†ๅฏ่จญๅฎš width, heightใ€‚

    • ๆ›ธๅฏซๆ–นๅผ้ ่จญ็‚บ writing-mode: horizontal-tb๏ผŒๆฐดๅนณๆ–นๅผใ€็”ฑไธŠๅˆฐไธ‹ๆŽ’็‰ˆใ€‚ (tb ไปฃ่กจ top to bottom)๏ผŒ่ทŸ้šจ flow direction ๆตๅ‹•ใ€‚

    • ๅ…ƒ็ด ๅ‰ๅพŒๅ„ๆœƒๆ’ๅ…ฅไธ€ๅ€‹่ทณ่กŒ (line break)ใ€‚

  • inline๏ผš

    • width, height ็”ฑๅฎƒ็š„ๅ…งๅฎน (content) ๆฑบๅฎš๏ผŒไธๅฏ่จญๅฎšใ€‚

    • ๅฏไปฅ่จญๅฎšๆฐดๅนณๆ–นๅ‘็š„ margin, paddingใ€‚

    • ็„กๆณ•่จญๅฎšๅž‚็›ดๆ–นๅ‘็š„ margin-top, margin-bottomใ€‚

    • ่ทŸ้šจ writing direction ๆตๅ‹•ใ€‚

  • inline-block๏ผš

    • ๆŽ’็‰ˆๆ–นๅผๅƒ inline ๅ…ƒ็ด ๏ผˆ็”ฑๅทฆ่‡ณๅณใ€็”ฑไธŠๅˆฐไธ‹๏ผ‰ใ€‚

    • ไฝ†ๅƒ block ๅ…ƒ็ด ๅฏ่จญๅฎš width, heightใ€‚

    • ๅ…งๅปบ inline-block ๅ…ƒ็ด ๏ผšimg, button, select, input, textareaใ€‚

  • inline-flex๏ผš

    • ๐Ÿšง

  • grid๏ผš

    • ๅฐ‡ๅ…ƒ็ด ่ฎŠๆˆไธ€ๅ€‹ๅฎนๅ™จ (container)๏ผŒๆœฌ่บซ่กŒ็‚บๅƒ block ๅ…ƒ็ด ๏ผŒไฝ†ๆ”น่ฎŠๅญๅ…ƒ็ด ็š„่กŒ็‚บใ€‚

  • flex๏ผš

    • ๅฐ‡ๅ…ƒ็ด ่ฎŠๆˆไธ€ๅ€‹ๅฎนๅ™จ (container)๏ผŒๆœฌ่บซ่กŒ็‚บๅƒ block ๅ…ƒ็ด ๏ผŒไฝ†ๆ”น่ฎŠๅญๅ…ƒ็ด ็š„่กŒ็‚บใ€‚

    • display: flex๏ผšๅญๅ…ƒ็ด ๆœๆฐดๅนณๆ–นๅ‘ๆŽ’็‰ˆ (flow direction ๅพž vertical ่ฎŠ็‚บ horizontal)

  • none๏ผš

    • ๅฐ‡ๅ…ƒ็ด ๅพž็•ซ้ขไธŠ็งป้™ค๏ผŒๅฝทๅฝฟๆฒ’้€™ๅ€‹ๅ…ƒ็ด ไธ€ๆจฃใ€‚

An element that is floated is automatically display: block.

Last updated