Makabila ya CSS - Kifupi cha Kifungu

Hii chakula itahakikiwa: transparentcurrentcolor na inherit Kile hiki

transparent kile hiki

transparent Kile hiki inatumiwa kumaliza rangi inayohifadhiwa. Inatumiwa kwa kumaliza rangi ya msahari ya kina.

Example

Kwenye hii, rangi ya msahari ya kifungu cha <div> itakuwa kina uwezo wa kuhifadhi, picha ya msahari itakuwa inayopatikana:

body {
  background-image: url("paper.gif");
}
div {
  background-color: transparent;
}

Try It Yourself

Ujumbe wa maelezo:transparent Kile hiki kinaingia kwa rgba(0,0,0,0)Rangi ya RGBA inaenea RGB, ina channel ya alpha - inasababisha uwezo wa rangi wa kuhifadhi kwenye ukurasa. Mafanikio zaidi tazama mafanikio yetu. CSS RGB Makala na Marejeo ya rangi ya CSS Makala.

currentcolor kile hiki

currentcolor Kile hiki inasema kama kiwango, kinasora thamani ya rangi ya kifungu cha kina:

Ikiwa unaonesha rangi gani inayotumiwa kwenye kina au ukurasa, kile hii inakuwa muhimu zaidi.

Example

Kwenye mivuno hii, rangi ya kifungu cha <div> itakuwa kijani kwa sababu rangi ya mawili ya kifungu cha <div> itakuwa kijani:

div {
  color: blue;
  border: 10px solid currentcolor;
}

Try It Yourself

Example

Kwenye mivuno hii, rangi ya msahari ya <div> inatambuliwa kwa rangi ya hali ya mabaki ya kikapteni:

body {
  color: purple;
}
div {
  background-color: currentcolor;
}

Try It Yourself

Example

In this example, the border color and shadow color of <div> are set to the current color value of the body element:

body {
 color: green;
}
div {
  box-shadow: 0px 0px 15px currentcolor;
  border: 5px solid currentcolor;
}

Try It Yourself

inherit Keyword

inherit The keyword specifies that the attribute should inherit its value from its parent element.

inherit Keywords can be used for any CSS attribute and can be used for any HTML element.

Example

In this example, the border setting of <span> will be inherited from the parent element:

div {
  border: 2px solid red;
}
span {
  border: inherit;
}

Try It Yourself