css top属性如何用
发布时间:09/01 来源:未知 浏览:
关键词:
css top属性如何用?
作用:top 属性规定元素的顶部边沿。该属性定义了一个定位元素的上外边距边界与其包括块上边界之间的偏移。
说明:
关于 static 元素,为 auto;
关于长度值,则为响应的绝对长度;
关于百分比数值,为指定值;
不然为 auto。
关于相对定义元素,假如 top 和 bottom 都是 auto,其运算值则都是 0;
假如其中之一为 auto,则取另一个值的相反数;
假如二者都不是 auto,bottom 将取 top 值的相反数。
注释:
所有主流阅读器都支撑 top 属性。任何的版本的 Internet Explorer (包罗 IE8)都不支撑属性值 "inherit"。
css top属性使用示例
<html> <head> <style type="text/css"> img { position:absolute; top:5px; } </style> </head> <body> <img src="https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg" /> <h1>This is a heading</h1> </body> </html>
结果输出:
以上就是css top属性如何用的具体内容,更多请关注百分百源码网其它相关文章!