1. CSS stands for Cascading Style Sheets
2. CSS describes how HTML elements are to be displayed on screen, paper, or in other media
3. CSS saves a lot of work. It can control the layout of multiple web pages all at once
4. External stylesheets are stored in CSS files
<p> elements will be center-aligned, with a red text color:
p {
text-align: center;
color: red;
}
p.center {
text-align: center;
color: red;
}
.center {
text-align: center;
color: red;
}
<head> of your .html
<link rel="stylesheet" type="text/css" href="mystyle.css">
body { background-color: lightblue; }
body { background-color: #ff0000; }
body { background-color: rgb(255, 0, 0); }
body { background-color: hsla(0, 100%, 50%); }
<h1>, <div>, and <span>.
The position property specifies the type of positioning method used for an element.
There are five different position values:
• static
• relative
• fixed
• absolute
• sticky
Elements are then positioned using the top, bottom, left, and right properties.
However, these properties will not work unless the position property is set first.
They also work differently depending on the position value.
position: static;
div.static {
position: static;
border: 3px solid #73AD21;
}
position: relative;
div.relative {
position: relative;
left: 30px;
border: 3px solid #73AD21;
}
position: fixed;
div.fixed {
position: fixed;
bottom: 0;
right: 0;
width: 300px;
border: 3px solid #73AD21;
}
position: absolute;
div.absolute {
position: absolute;
top: 80px;
right: 0;
width: 200px;
border: 3px solid #73AD21;
}
position: sticky;
div.sticky {
position: -webkit-sticky;
position: sticky;
top: 0;
padding: 5px;
border: 3px solid #73AD21;
background-color: #eee;
font-size: 20px;
}
dotted - Defines a dotted borderdashed - Defines a dashed bordersolid - Defines a solid borderdouble - Defines a double bordergroove - Defines a 3D grooved border. The effect depends on the border-color valueridge - Defines a 3D ridged border. The effect depends on the border-color valueinset - Defines a 3D inset border. The effect depends on the border-color valueoutset - Defines a 3D outset border. The effect depends on the border-color valuenone - Defines no borderhidden - Defines a hidden border
p.dotted { border-style: dotted; }
p.dashed { border-style: dashed; }
p.solid { border-style: solid; }
p.double { border-style: double; }
p.groove { border-style: groove; }
p.ridge { border-style: ridge; }
p.inset { border-style: inset; }
p.outset { border-style: outset; }
p.none { border-style: none; }
p.hidden { border-style: hidden; }
dotted
dashed
solid
double
groove
ridge
inset
outset
none
hidden