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

n. Pad; lining; redundant language; nonsense

v. Pad..., add cushion (present participle of pad );Walk, walk softly

javascript padding attribute syntax

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

Syntax: Object.style.padding=padding

javascript padding attribute example

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

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

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

</body>
</html>

Run instance »

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