CSS浮动:float

css浮动:float

float 属性定义元素在哪个方向浮动。

浮动元素会生成一个块级框,而不论它本身是何种元素。

描述
left 元素向左浮动。
right 元素向右浮动。
none 默认值。元素不浮动,并会显示在其在文本中出现的位置。
inherit 规定应该从父元素继承 float 属性的值。

eg:

<html>

  <head>

    <style type="text/css">

      div
      {
        float:right;
      }
    </style>

  </head>

  <body>

    <div>

      <img src="http://www.w3school.com.cn/i/eg_cute.gif" />
    </div>

    <p>

      This is a picture.

    </p>

  </body>

</html>

posted @ 2013-08-06 19:45  沧海浮游  阅读(103)  评论(0)    收藏  举报