Style paddingTop Property

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->




Style paddingTop Property


❮ Style Object



Example


Set the top padding of a <div> element:



document.getElementById("myDiv").style.paddingTop = "50px";

Try it Yourself »


Definition and Usage



The paddingTop property sets or returns the top padding of an element.


The padding properties define the space between the element border and the
element content.


Both the margin property and the padding property insert space around an
element. However, the difference is that margin inserts the space around the
border, while padding inserts the space within the border of an element.



Browser Support














Property
paddingTop Yes Yes Yes Yes Yes

Syntax


Return the paddingTop property:



object.style.paddingTop

Set the paddingTop property:



object.style.paddingTop = "%|length|initial|inherit"

Property Values













Value Description
% Defines the top padding in % of the width of the parent element
length Defines the top padding in length units
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit




<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->




Technical Details








Default Value: 0
Return Value: A String, representing the top padding of an element
CSS Version CSS1

More Examples



Example


Change the top padding of a <div> element back to "normal":



document.getElementById("myDiv").style.paddingTop = "0px";

Try it Yourself »



Example


Return the top padding of a <div> element:



alert(document.getElementById("myDiv").style.paddingTop);

Try it Yourself »



Example


Difference between marginTop and paddingTop:



function changeMargin()
  document.getElementById("myDiv").style.marginTop = "100px";


function changePadding()
  document.getElementById("myDiv2").style.paddingTop = "100px";


Try it Yourself »


Related Pages


CSS tutorial: CSS Padding


CSS reference: padding-top property


HTML DOM reference: padding property




❮ Style Object

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)