[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/CSS/Reference/Properties/float [Back]  [Original]

float - CSS: Cascading Style Sheets | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

float

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

CSS (property) float (element) (normal flow) (inline) .

In this article

float: none;
float: left;
float: right;
float: inline-start;
float: inline-end;
<section class="default-example" id="default-example">
  <div class="example-container">
    <div class="transition-all" id="example-element">Float me</div>
    As much mud in the streets as if the waters had but newly retired from the
    face of the earth, and it would not be wonderful to meet a Megalosaurus,
    forty feet long or so, waddling like an elephantine lizard up Holborn Hill.
  </div>
</section>
.example-container {
  border: 1px solid #c5c5c5;
  padding: 0.75em;
  text-align: left;
  width: 80%;
  line-height: normal;
}

#example-element {
  border: solid 10px #efac09;
  background-color: #040d46;
  color: white;
  padding: 1em;
  width: 40%;
}

**(floating) ** float (computed value) none .

none
all elements, but has no effect if the value of display is none.
no
as specified
Animation typediscrete

float , display :

(Specified value)
inline block
inline-block block
inline-table table
table-row block
table-row-group block
table-column block
table-column-group block
table-cell block
table-caption block
table-header-group block
table-footer-group block
flex flex, float
inline-flex inline-flex, float

: JavaScript element.style , cssFloat . Internet Explorer 8 styleFloat . DOM dash(-) CSS (camel-case) ( "class" "className" <label> "for" "htmlFor" "float" JavaScript ).

css
/*   */
float: left;
float: right;
float: none;
float: inline-start;
float: inline-end;

/*   */
float: inherit;
float: initial;
float: unset;

left

(containing) (float, ) .

.

none

.

inline-start

. , ltr(left to right) rtl(right to left) .

inline-end

. , ltr rtl .

float = 
block-start |
block-end |
inline-start |
inline-end |
snap-block |
<snap-block()> |
snap-inline |
<snap-inline()> |
left |
right |
top |
bottom |
none |
footnote

<snap-block()> =
snap-block( <length> , [ start | end | near ]? )

<snap-inline()> =
snap-inline( <length> , [ left | right | near ]? )
CSS Generated Content for Paged Media Module, CSS Page Floats . . .

CSS

css
div {
  border: solid red;
  max-width: 70ex;
}
h4 {
  float: left;
  margin: 0;
}

HTML

html
<div>
  <h4>HELLO!</h4>
  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.
</div>

float

, . (edge) .

, . . "" . . (wrap).

[]

float

, . , , . , (paragraph) "Lorem ipsum dolor sit amet," "Floats Example" (heading) , . , . , float (clear) .

float clear :

css
h2.secondHeading {
  clear: both;
}

, (block formatting context) . h2 (sidebar) (sibling) , clear .

float , (approach) . , p . , () hidden auto p overflow :

css
p.withRedBoxes {
  overflow: hidden;
  height: auto;
}

Specification
Cascading Style Sheets Level 2
# propdef-float
CSS Logical Properties and Values Module Level 1
# float-clear


Web Proxy Viewer  |  New URL  |  Original Page