Style paddingTop ਪ੍ਰਤੀਯੋਗਿਤਾ

ਪਰਿਭਾਸ਼ਾ ਅਤੇ ਵਰਤੋਂ

paddingTop Property sets or returns the top padding of the element.

The padding property defines the space between the element's border and its content.

margin property and padding property Insert space around the element. However, the difference is that, margin inserts space around the border, while padding inserts space inside the element's border.

See also:

CSS Tutorial:CSS ਅੰਦਰੂਨੀ ਪੈਡਿੰਗ

CSS Reference Manual:padding-top property

HTML DOM Reference Manual:padding property

Instance

Example 1

Set the top padding of the <div> element:

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

Try it yourself

Example 2

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

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

Try it yourself

Example 3

Return the top padding of the <div> element:

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

Try it yourself

Example 4

Difference between marginTop and paddingTop:

function changeMargin() {
  document.getElementById("myDiv").style.marginTop = "100px";
}
function changePadding() {
  document.getElementById("myDiv2").style.paddingTop = "100px";
}

Try it yourself

Syntax

return paddingTop property:

object.style.paddingTop

set paddingTop property:

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

ਵਿਸ਼ੇਸ਼ਤਾ ਮੁੱਲ

ਮੁੱਲ ਵਰਣਨ
% ਪੈਰੈਂਟ ਏਲੀਮੈਂਟ ਦੇ ਚੌਡਾਈ ਦੇ ਪ੍ਰਤੀਸ਼ਤ ਨਾਲ ਉੱਚੀ ਅੰਦਰੂਨੀ ਬਾਹਰੀ ਮੈਰਜਿਨ ਨਾਲ ਵਿਸਥਾਰਿਤ ਕਰੋ。
length ਲੰਬਾਈ ਇਕਾਈ ਨਾਲ ਉੱਚੀ ਅੰਦਰੂਨੀ ਬਾਹਰੀ ਮੈਰਜਿਨ ਨਾਲ ਵਿਸਥਾਰਿਤ ਕਰੋ。
initial ਇਹ ਵਿਸ਼ੇਸ਼ਤਾ ਇਸ ਦੇ ਮੂਲਤਬੀ ਮੁੱਲ 'ਤੇ ਸੈਟ ਕਰੋ। ਦੇਖੋ initial
inherit ਇਹ ਵਿਸ਼ੇਸ਼ਤਾ ਆਪਣੇ ਮਾਤਾ ਏਲੀਮੈਂਟ ਤੋਂ ਇਸ ਵਿਸ਼ੇਸ਼ਤਾ ਲੈ ਲੈਂਦੀ ਹੈ। ਦੇਖੋ inherit

ਤਕਨੀਕੀ ਵੇਰਵਾ

ਮੂਲਤਬੀ ਮੁੱਲ: 0
ਵਾਪਸੀ ਮੁੱਲ: ਚਿੰਨ੍ਹ, ਜੋ ਕਿ ਏਲੀਮੈਂਟ ਦੀ ਉੱਚੀ ਅੰਦਰੂਨੀ ਬਾਹਰੀ ਮੈਰਜਿਨ ਨੂੰ ਪ੍ਰਦਰਸ਼ਿਤ ਕਰਦਾ ਹੈ。
CSS ਸੰਸਕਰਣ: CSS1

ਬਰਾਊਜ਼ਰ ਸਪੋਰਟ

Chrome Edge Firefox ਸੈਫਾਰੀ ਓਪਰਾ
Chrome Edge Firefox ਸੈਫਾਰੀ ਓਪਰਾ
ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ