Youcef Madadi
Web and game development teacher
Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in a markup language such as HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.
Css extension is simply .css
We can include the css file using Link tag
css file mainly contain a set of elements called rules
the rules contain attributes that describes the element that is meant to be styled.
Each attributes comes with key and value.
<link rel="stylesheet" href="css/style.css" />
tag{
color: red;
}
using tags
A rule affect more than one selector
Universal selector
Select Classes ( . ) , select Id ( # )
Nested elements
Pseudo classes
Pseudo elements
div{
color: red;
}
li,ul{
padding : 0;
}
*{
color: white;
}
.className , #IDName{
backgroud: red;
}
.parent .son{
backgroud: yellow;
}
div:hover{
backgroud: blue;
}
div::first-line{
backgroud: purple;
}
div{
border: 1px solid red;
}
div{
padding: 10px;
}
div{
background: green;
margin: 10px;
}
<div>this is an element</div>
margin : 10px ;
margin : 10px 0 10px 10px;
margin-left: 10px;
<div>this is an element</div>
All directions
Specific directions
(top , right , bottom left )
Specific one direction
.div {
border: 1px solid red;
padding: 10px;
background: green;
width: 100px;
box-sizing: content-box;
}
box-sizing : content-box
.div {
border: 1px solid red;
padding: 10px;
background: green;
width: 100px;
box-sizing: border-box;
}
box-sizing : border-box
position : absolute
position : relative
position : fixed
position : sticky
display : block
display : none
display : Flex
By Youcef Madadi