CSS içeriği Özellik
Örnek
Aşağıdaki örnek, her <a> öğesinden sonra parantez içinde href niteliğinin değerini ekler:
a::after {
content: " (" attr(href) ")";
}
Aşağıda daha fazla "Kendiniz Deneyin" örnekleri.
Tanım ve Kullanım
Özellik content
, oluşturulan içeriği eklemek için
::before ve ::after sözde öğeleriyle birlikte kullanılır.
Varsayılan değer: | normal |
---|---|
Miras: | Hayır |
canlandırılabilir: | Hayır. Canlandırılabilir hakkında bilgi edinin |
Sürüm: | CSS2 |
JavaScript sözdizimi: | JavaScript kullanarak bir öğeye sözde sınıf veremezsiniz, ancak aynı sonucu almanın başka yolları da vardır: |
Tarayıcı Desteği
Tablodaki sayılar, özelliği tam olarak destekleyen ilk tarayıcı sürümünü belirtir.
Property | |||||
---|---|---|---|---|---|
content | 1.0 | 8.0 | 1.0 | 1.0 | 4.0 |
CSS Sözdizimi
content: normal|none|counter|attr|string|open-quote|close-quote|no-open-quote|no-close-quote|url|initial|inherit;
Mülk değerleri
Value | Description | Example |
---|---|---|
normal | Default value. Sets the content, if specified, to normal, which default is "none" (which is nothing) | |
none | Sets the content, if specified, to nothing | |
counter | Sets the content as a counter | |
attr(attribute) | Sets the content as one of the selector's attribute | |
string | Sets the content to the text you specify | |
open-quote | Sets the content to be an opening quote | |
close-quote | Sets the content to be a closing quote | |
no-open-quote | Removes the opening quote from the content, if specified | |
no-close-quote | Removes the closing quote from the content, if specified | |
url(url) | Sets the content to be some kind of media (an image, a sound, a video, etc.) | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Daha fazla örnek
Örnek
Varsayılan madde işaretlerini kaldırarak ve madde işaretlerine (•) benzeyen bir HTML varlığı ekleyerek <ul> veya <ol> için madde işareti renkleri nasıl eklenir:
ul {
list-style: none; /* Remove HTML bullets */
padding: 0;
margin: 0;
}
li {
padding-left: 16px;
}
li::before {
content: "•"; /* Insert content that looks like bullets */
padding-right: 8px;
color: blue; /* Or a color you prefer */
}
İlgili Sayfalar
CSS referansı: ::sözde öğeden önce
CSS referansı: ::sözde öğeden sonra