CSS Stands for Cascading Style Sheets. CSS is used to style a website. Here is an example of CSS Code
h1 {
color: goldenrod;
font-size: 2rem;
}
Css is made up of 2 parts - the selector and the declaration. In the example above, h1
is the selector and color: goldenrod;
is the declaration. The declaration can be broken into two parts. To the left of the :
is the property(color
), and to the right is the property value(goldenrod
).
Three things to remember
;
to separate the different sectors, and:
to separate the property from its value.We can also select multiple selector. all we would have to do is add a commas between them.
h1,
.header-text,
.page-title {
color: goldenrod;
font-size: 2rem;
}
<link rel="stylesheet" href="style.css">
<style>
.class{
font-weight: 600;
}
</style>
<p style="color: red;"> Red Paragraph </p>
<p>
elements red textp {
color: red;
}
red
, blue
, green
#ffffff
or #000000
rgb(255,0,0)
will give you the color red.rgba(255,0,0,0.5)
will give you the color red at 50% opacity.hsl(0, 100%, 50%)
is the color redhsla(0,100%,50%,0.25)
will result in a color with 25% opacitymix(red, blue)