[CSS] float

iamhyunjiยท2022๋…„ 6์›” 7์ผ
0
post-thumbnail

๐Ÿ“Œ float


  • ์š”์†Œ(element)๋ฅผ ์ปจํ…Œ์ด๋„ˆ์˜ ์™ผ์ชฝ ๋˜๋Š” ์˜ค๋ฅธ์ชฝ์— ๋†“๋Š” ์†์„ฑ
  • ํ…์ŠคํŠธ๋‚˜ ์ธ๋ผ์ธ ์š”์†Œ๊ฐ€ float๋œ ์š”์†Œ์˜ ์ฃผ๋ณ€์„ ๊ฐ์Œˆ
  • float๋œ ์š”์†Œ๋Š” ํŽ˜์ด์ง€ ๋‚ด ํ๋ฆ„์—์„œ ๋น ์ง

๐Ÿ“Œ ๊ตฌ๋ฌธ


elementName,
.className,
#idName {
  float: none;
  float: left;
  float: right;
  float: inline-start;
  float: inline-end;
} 
  • none
  • left
  • inline-start
  • inline-end

float ์†์„ฑ์€ ์ด 5๊ฐœ์˜ ๊ฐ’์„ ๊ฐ€์ง€๋ฉฐ, ๊ฐ’์— ๋”ฐ๋ผ ์š”์†Œ์˜ ์œ„์น˜๊ฐ€ ์ง€์ •๋œ๋‹ค.

none

  • ๊ธฐ๋ณธ๊ฐ’
  • floatํ•˜์ง€ ์•Š์Œ ๋˜๋Š” ๋ถ€๋™์„ ์˜๋ฏธ
<!DOCTYPE html>
<html>
  <head>
    <style>
    img {
      float: none;
    }
    </style>
  </head>
  <body>

    <p><img src="https://i.pinimg.com/550x/b6/2b/56/b62b56a78f93ce5be9e68b291e45a8d8.jpg"/>This is some text.
    This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    </p>

    <p>In the paragraph above, the first letter of the text is embedded in a span element. The span element has a width that is 0.7 times the size of the current font. The font-size of the span element is 400% (quite large) and the line-height is 80%. The font of the letter in the span will be in "Algerian".</p>

  </body>
</html>
  • ๊ฒฐ๊ณผ
    float: none;

left

  • ์ปจํ…Œ์ด๋„ˆ์˜ ์™ผ์ชฝ์œผ๋กœ ์š”์†Œ๊ฐ€ ์ด๋™
<!DOCTYPE html>
<html>
  <head>
    <style>
    img {
      float: left;
    }
    </style>
  </head>
  <body>

    <p><img src="https://i.pinimg.com/550x/b6/2b/56/b62b56a78f93ce5be9e68b291e45a8d8.jpg"/>This is some text.
    This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    </p>

    <p>In the paragraph above, the first letter of the text is embedded in a span element. The span element has a width that is 0.7 times the size of the current font. The font-size of the span element is 400% (quite large) and the line-height is 80%. The font of the letter in the span will be in "Algerian".</p>

  </body>
</html>
  • ๊ฒฐ๊ณผ
    float: left
  • ์ปจํ…Œ์ด๋„ˆ์˜ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ์š”์†Œ๊ฐ€ ์ด๋™
<!DOCTYPE html>
<html>
  <head>
    <style>
    img {
      float: right;
    }
    </style>
  </head>
  <body>

    <p><img src="https://i.pinimg.com/550x/b6/2b/56/b62b56a78f93ce5be9e68b291e45a8d8.jpg"/>This is some text.
    This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    This is some text. This is some text. This is some text.
    </p>

    <p>In the paragraph above, the first letter of the text is embedded in a span element. The span element has a width that is 0.7 times the size of the current font. The font-size of the span element is 400% (quite large) and the line-height is 80%. The font of the letter in the span will be in "Algerian".</p>

  </body>
</html>
  • ๊ฒฐ๊ณผ
    float: right

initial

  • ์†์„ฑ์„ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์„ค์ •

inherit

  • ๋ถ€๋ชจ์˜ ์š”์†Œ๋กœ๋ถ€ํ„ฐ ์†์„ฑ์„ ์ƒ์† ๋ฐ›์Œ

๐Ÿ”— ์ฐธ๊ณ ยท์ถœ์ฒ˜


profile
Lv0. ์›น ๊ฐœ๋ฐœ (โค๏ธโค๏ธโค๏ธ๐Ÿค)

0๊ฐœ์˜ ๋Œ“๊ธ€