当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS top属性

CSS
CSS2 Aural
CSS 单位
CSS 颜色
CSS 颜色值
CSS 颜色名称
CSS 编码与组织技巧
CSS 模块化设计思路
CSS完美兼容IE6/IE7/FF的通用方法
CSS @ Ten: 下一个重要的东西

CSS top属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 317 ::
收藏到网摘: n/a

The top property specifies the top edge of an element.
top 属性可以指定与其最近一个具有定位设置的父对象顶边相关的位置

Note: If the "position" property has a value of "static", the "top" property has no effect.
注意:”position“属性值为"static"的话,"top"属性就没有效果

Inherited: No
继承性:无

举例

This example sets the top edge of the paragraph 20 px below the top edge of the window:
这个举例可让段落放置在窗口的最上边,并向下20px:
p
{
position: absolute;
top: 20px
}

This example sets the top edge of the paragraph 20 px above the top edge of the window:
这个举例可让段落放置在窗口的最上边,并向上20px:
p
{
position: absolute;
top: -20px
}

可用值

描述
auto Lets the browser calculate the top position
让浏览器决定top定位
% Sets the top position in % from the top edge of the window
以窗口大小的百分比来决定top定位
length Sets the top position in px, cm, etc. from the top edge of the window. Negative values are allowed
用px,cm这些单位来决定top定位.可以使用负数

评论 (0) All

登陆 | 还没注册?