Stil whiteSpace Özellik
Örnek
<div> öğesindeki metnin hiçbir zaman kaydırılmayacağını belirtin:
document.getElementById("myDIV").style.whiteSpace = "nowrap";
Tanım ve Kullanım
whiteSpace özelliği, bir metindeki sekmelerin, satır sonlarının ve boşlukların nasıl işleneceğini ayarlar veya döndürür.
Tarayıcı Desteği
Property | |||||
---|---|---|---|---|---|
whiteSpace | Yes | Yes | Yes | Yes | Yes |
Sözdizimi
whiteSpace özelliğini döndürün:
object.style.whiteSpace
whiteSpace özelliğini ayarlayın:
object.style.whiteSpace = "normal|nowrap|pre|initial|inherit"
Mülk değerleri
Value | Description |
---|---|
normal | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default |
nowrap | Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered |
pre | Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the <pre> tag in HTML |
pre-line | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks |
pre-wrap | Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks |
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: | normal |
---|---|
Geri dönüş değeri: | Bir öğenin içindeki beyaz boşluğun nasıl işlendiğini temsil eden bir Dize |
CSS Sürümü | CSS1 |
Daha fazla örnek
Örnek
whiteSpace özelliğini döndür
alert(document.getElementById("myDiv").style.whiteSpace);
İlgili Sayfalar
CSS eğitimi: CSS Metni
CSS referansı: boşluk özelliği
❮ Stil Nesnesi