javascript top attribute


  Translation results:

英[tɒp] 美[tɑ:p]

n. Top, top; (box) cover, (book pages, etc.) upper column; chief; top

adj. Highest of; top; first-class; the largest

vt. form the top; reach the top of...; be at the forefront of...; lead

vi. Summary; transcend; tower; end

Third person singular: tops Plural: tops Present participle: topping Past tense: topped Past participle: topped

javascript top attributesyntax

Function: Sets the offset between the top margin boundary of a positioned element and the top boundary of its containing block.

Syntax: Object.style.top=auto|%|length

Comments: If the value of the "position" attribute is "static" , then setting the "top" attribute will have no effect.

javascript top attributeexample

<html>
<head>
<style type="text/css">
input
{
position:absolute;
}
</style>
<script type="text/javascript">
function setTopEdge()
{
document.getElementById("b1").style.top="100px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setTopEdge()"
value="Set top edge to 100 px" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance


##

Popular Recommendations

Home

Videos

Q&A