Stil marginBottom Özellik
Örnek
Bir <div> öğesinin alt kenar boşluğunu ayarlayın:
document.getElementById("myDiv").style.marginBottom = "50px";
Tanım ve Kullanım
marginBottom özelliği, bir öğenin alt kenar boşluğunu ayarlar veya döndürür.
Hem margin özelliği hem de padding özelliği, bir öğenin etrafına boşluk ekler. Ancak fark, kenar boşluğunun sınırın etrafındaki boşluğu eklemesi, dolgunun ise boşluğu bir öğenin sınırının içine eklemesidir.
Tarayıcı Desteği
Property | |||||
---|---|---|---|---|---|
marginBottom | Yes | Yes | Yes | Yes | Yes |
Sözdizimi
marginBottom özelliğini döndürün:
object.style.marginBottom
marginBottom özelliğini ayarlayın:
object.style.marginBottom = "%|length|auto|initial|inherit"
Mülk değerleri
Value | Description |
---|---|
% | Defines the bottom margin in % of the width of the parent element |
length | Defines the bottom margin in length units |
auto | The browser sets the bottom margin |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Teknik detaylar
Varsayılan değer: | 0 |
---|---|
Geri dönüş değeri: | Bir elemanın alt kenar boşluğunu temsil eden bir Dize |
CSS Sürümü | CSS1 |
Daha fazla örnek
Örnek
Bir <div> öğesinin alt kenar boşluğunu "normal" olarak değiştirin:
document.getElementById("myDiv").style.marginBottom = "0px";
Örnek
Bir <div> öğesinin alt kenar boşluğunu döndür:
alert(document.getElementById("myDiv").style.marginBottom);
Örnek
marginBottom ve paddingBottom arasındaki fark:
function changeMargin() {
document.getElementById("myDiv").style.marginBottom = "100px";
}
function changePadding() {
document.getElementById("myDiv2").style.paddingBottom = "100px";
}
İlgili Sayfalar
CSS eğitimi: CSS Marjı
CSS referansı: kenar boşluğu alt özelliği
HTML DOM referansı: kenar boşluğu özelliği
❮ Stil Nesnesi