0Pricing
HTML for Kids · Lesson

Color ve Background

Color ve Background

Introduction

Hello,

We can change the colors of the text with the Color property.

We can assign the values to this property in RGB, HEX, HSL, RGBA, or HSLA type.

We have already used the color property in many examples so far. Now let's illustrate its usage with different value types.

<style>

#txt1{
    color: red;
}

#txt2{
    color: #ff0000;
}

#txt3{
    color:  rgb(255,0,0);
}

/*  
   0.4 is the alpha value. 
   We can define decimal values 
   between 1 and 0.
 */
#txt4{
    color:  rgba(255,0,0, 0.4);
}

</style>

<div class="box">
<h1 id="txt1">
    This is red color
</h1>
<h1 id="txt2">
    This is red color that defined with HEX type
</h1>
<h1 id="txt3">
    This is red color that defined with RGB type
</h1>
<h1 id="txt4">
    This is red color that defined with RGBA type
</h1>
</div>

Background

We can define styles to the backgrounds of the elements using the Background properties.

Now let's learn the background properties listed below.

  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position
← Back to HTML for Kids