Style paddingTop প্রকৃতি

সংজ্ঞা এবং ব্যবহার

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

The inner padding attribute 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 within 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 <div> element's top inner padding:

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

Try it yourself

Example 2

Return the <div> element's top inner padding to "normal":

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

Try it yourself

Example 3

Return the top inner 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 the paddingTop property:

object.style.paddingTop

Set the paddingTop property:

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

Attribute value

Value Description
% Define the top inner padding as a percentage of the parent element's width.
length Define the top inner padding with length units.
initial This property sets its default value. See initial.
inherit This property inherits from its parent element. See inherit.

Technical details

Default value: 0
Return value: A string that represents the top inner padding of the element.
CSS version: CSS1

browser support

Chrome Edge Firefox স্যাফারি ওপেরা
Chrome Edge Firefox স্যাফারি ওপেরা
সমর্থন সমর্থন সমর্থন সমর্থন সমর্থন