javascript paddingTop property


  Translation results:

padding

英[ˈpædɪŋ] 美[ˈpædɪŋ]

n.Padding; lining; redundant language; nonsense

v. To pad something, to add a cushion (the present participle of pad); to walk, to walk lightly

top

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

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

adj. The highest; top; first-class; largest

vt. Form the top; reach the top of…; be at the forefront of…; lead

vi. Summarize; transcend; tower; end

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

javascript paddingTop propertysyntax

Function: Set the top padding of the element. Defines the space between the element's border and its content.

Syntax: Object.style.paddingTop=length|%

javascript paddingTop propertyexample

<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000;
}
</style>
<script type="text/javascript">
function changePadding()
{
document.getElementById("p1").style.paddingTop="2cm";
}
</script>
</head>
<body>

<input type="button" onclick="changePadding()"
value="Change top padding" />

<p id="p1">This is a paragraph</p>

</body>
</html>

Run instance »

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

Home

Videos

Q&A