代码示例:(标识:css_float_3)
<!DOCTYPE html>
<html>
<head>
<style>
div {
  float: right;
  width: 120px;
  margin: 0 0 15px 20px;
  padding: 15px;
  border: 1px solid black;
  text-align: center;
}
</style>
</head>
<body>

<div>
<img src="/static/demo/images/logo-1.png" width="188" height="267"><br>CSS is fun!
</div>

<p>
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.
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>
在上面的段落中,div 元素的宽度为 120 像素,其中包含图像。
div 元素将向右浮动。外边距被添加到 div 以将文本推离 div。
将边框和内边距(填充)添加到 div 中,以凸显图片和标题。
</p>

</body>
</html>
运行结果: