HTML DOM position Property
Complete Style Object Reference
Definition and Usage
The position property places an element in a static, relative, absolute or
fixed position.
Syntax
Object.style.position=static|relative|absolute|fixed
|
Possible Values
Value |
Description |
static |
Default. An element with position: static always has the
position the normal flow of the page gives it (a static element ignores any
top, bottom, left, or right declarations) |
relative |
An element with position: relative moves an element relative to its normal position, so "left:20"
adds 20 pixels to the element's LEFT position |
absolute |
An element with position: absolute is positioned at the
specified coordinates relative to its containing block. The element's position is specified with the
"left", "top", "right", and
"bottom" properties |
fixed |
An element with position: fixed is positioned at the
specified coordinates relative to the browser window. The element's position is specified with the
"left", "top", "right", and
"bottom" properties. The element remains at that position
regardless of scrolling. Works in IE 7 (strict mode) |
Example
The following example changes an element position from relative to absolute:
<html>
<head>
<style type="text/css">
input
{
position:relative;
}
</style>
<script type="text/javascript">
function setPositionAbsolute()
{
document.getElementById("b1").style.position="absolute";
document.getElementById("b1").style.top="10px";
}
</script>
</head>
<body>
<p>This is an example paragraph</p>
<p>This is an example paragraph</p>
<input type="button" id="b1" onclick="setPositionAbsolute()"
value="Set button position to be absolute" />
</body>
</html>
|
Try-It-Yourself Demos
position - Change an element position
Complete Style Object Reference
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
|