- CSS 参考手册
- CSS 参考手册
- CSS 选择器
- CSS 语音参考
- CSS Web安全字体组合
- CSS 动画
- CSS 单位
- CSS 颜色
- CSS 合法颜色值
- CSS 颜色名称
- CSS 颜色十六进制值
- CSS 属性列表
- CSS align-content
- CSS align-items
- CSS align-self
- CSS all
- CSS animation (动画)
- CSS animation-delay
- CSS animation-direction
- CSS animation-duration
- CSS animation-fill-mode
- CSS animation-iteration-count
- CSS animation-name
- CSS animation-play-state
- CSS animation-timing-function
- CSS appearance
- CSS backface-visibility
- CSS background
- CSS background-attachment
- CSS background-clip
- CSS background-color
- CSS background-image
- CSS background-origin
- CSS background-position
- CSS background-repeat
- CSS background-size
- CSS border
- CSS border-bottom
- CSS border-bottom-color
- CSS border-bottom-left-radius
- CSS border-bottom-right-radius
- CSS border-bottom-style
- CSS border-bottom-width
- CSS border-collapse
- CSS border-color
- CSS border-image
- CSS border-image-outset
- CSS3 border-image-repeat
- CSS border-image-slice
- CSS border-image-source
- CSS border-image-width
- CSS border-left
- CSS border-left-color
- CSS border-left-style
- CSS border-left-width
- CSS border-radius
- CSS border-right
- CSS border-right-color
- CSS border-right-style
- CSS border-right-width
- CSS border-spacing
- CSS border-style
- CSS border-top
- CSS border-top-color
- CSS border-top-left-radius
- CSS border-top-right-radius
- CSS border-top-style
- CSS border-top-width
- CSS border-width
- CSS bottom
- CSS box-align
- CSS box-direction
- CSS box-flex
- CSS box-flex-group
- CSS box-lines
- CSS box-ordinal-group
- CSS box-orient
- CSS box-pack
- CSS box-shadow
- CSS box-sizing
- CSS caption-side
- CSS clear
- CSS clip
- CSS color
- CSS column-count
- CSS column-fill
- CSS column-gap
- CSS column-rule
- CSS column-rule-color
- CSS column-rule-style
- CSS column-rule-width
- CSS column-span
- CSS column-width
- CSS columns
- CSS content
- CSS counter-increment
- CSS counter-reset
- CSS cursor
- CSS direction
- CSS display
- CSS empty-cells
- CSS flex
- CSS flex-basis
- CSS flex-direction
- CSS flex-flow
- CSS flex-grow
- CSS flex-shrink
- CSS flex-wrap
- CSS float
- CSS font
- CSS3 @font-face
- CSS font-family
- CSS font-size
- CSS3 font-size-adjust
- CSS3 font-stretch
- CSS font-style
- CSS font-variant
- CSS font-weight
- CSS3 grid-columns
- CSS3 grid-rows
- CSS3 hanging-punctuation
- CSS height
- CSS3 icon
- CSS justify-content
- CSS3 @keyframes
- CSS left
- CSS letter-spacing
- CSS line-height
- CSS list-style
- CSS list-style-image
- CSS list-style-position
- CSS list-style-type
- CSS margin
- CSS margin-bottom
- CSS margin-left
- CSS margin-right
- CSS margin-top
- CSS max-height
- CSS max-width
- CSS3 @media
- CSS min-height
- CSS min-width
- CSS3 nav-down
- CSS3 nav-index
- CSS3 nav-left
- CSS3 nav-right
- CSS3 nav-up
- CSS3 opacity
- CSS3 order
- CSS outline
- CSS outline-color
- CSS3 outline-offset
- CSS outline-style
- CSS outline-width
- CSS overflow
- CSS3 overflow-x
- CSS3 overflow-y
- CSS padding
- CSS padding-bottom
- CSS padding-left
- CSS padding-right
- CSS padding-top
- CSS page-break-after
- CSS page-break-before
- CSS page-break-inside
- CSS3 perspective
- CSS3 perspective-origin
- CSS position
- CSS3 punctuation-trim
- CSS quotes
- CSS3 resize
- CSS right
- CSS3 rotation
- CSS tab-size
- CSS table-layout
- CSS3 target
- CSS3 target-name
- CSS inherit
- CSS initial
- CSS3 target-new
- CSS3 target-position
- CSS text-align
- CSS text-align-last
- CSS text-decoration
- CSS text-decoration-color
- CSS text-decoration-line
- CSS text-decoration-style
- CSS text-indent
- CSS3 text-justify
- CSS3 text-outline
- CSS3 text-overflow
- CSS3 text-shadow
- CSS text-transform
- CSS3 text-wrap
- CSS top
- CSS3 transform
- CSS3 transform-origin
- CSS3 transform-style
- CSS3 transition-delay
- CSS3 transition-duration
- CSS3 transition-property
- CSS3 transition-timing-function
- CSS unicode-bidi
- CSS vertical-align
- CSS visibility
- CSS white-space
- CSS width 宽度
- CSS3 word-break
- CSS word-spacing
- CSS3 word-wrap
- CSS z-index
CSS float
CSS float 属性与用法
float属性指定一个盒子(元素)是否应该浮动。
注意: 绝对定位的元素忽略float属性!
默认值: | none |
---|---|
继承: | no |
版本: | CSS1 |
JavaScript 语法: | object.style.cssFloat="left" |
CSS float 属性值
值 | 描述 |
---|---|
left | 元素向左浮动。 |
right | 元素向右浮动。 |
none | 默认值。元素不浮动,并会显示在其在文本中出现的位置。 |
inherit | 规定应该从父元素继承 float 属性的值。 |
CSS float 浏览器支持
所有主流浏览器都支持float属性。
注意: IE7和更早的版本不支持"inherit"的值。IE8需要定义!DOCTYPE。IE9支持"inherit"。
CSS float 实例
让图像向右侧浮动:
img {
float:right;
}
更多实例
段落的首字母浮动于左侧
使段落的首字母浮动于左侧,并向这个字母添加样式。
创建一个水平菜单
使用浮动来创建水平菜单的超链接列表。
创建无表格的首页
使用浮动来创建拥有页眉、页脚、左侧目录和主体内容的首页。
相关文章
CSS 教程: CSS Float