03 CSS
03 CSS
12 mars 2024
Lecturer
Dr. HAMDANI M
2 Colors in CSS
5 CSS Flexbox
6 Project 01
2 Colors in CSS
5 CSS Flexbox
6 Project 01
What is CSS ?
...
property: value;
}
p {
font-family: sans-serif;
color: red;
}
<head>
...
<link href="filename" type="text/css" rel="stylesheet" />
...
</head>
Unit Description
px Pixels, ideal for screen-based design.
pt Points, equal to 1/72 of an inch, used in print.
pc Picas, equal to 12 points or 1/6 of an inch.
in Inches, a physical unit of measurement.
cm Centimeters, a physical unit of measurement.
mm Millimeters, a physical unit of measurement.
Unit Description
em Relative to the font size of the element.
rem Relative to the font-size of the root element.
% Percent, relative to the parent element’s property.
vw Viewport width, 1% of the viewport’s width.
vh Viewport height, 1% of the viewport’s height.
vmin 1% of the viewport’s smaller dimension.
vmax 1% of the viewport’s larger dimension.
Unit Description
ex Roughly the height of a lowercase letter.
ch Width of the "0" character in the current font.
q Quarter-millimeters, mainly used in print contexts.
2 Colors in CSS
5 CSS Flexbox
6 Project 01
Color formats in CSS
Ease of use : Color names are the simplest, while hex codes and
RGB/RGBA values require more technical knowledge.
Precision : Hex codes and RGB/RGBA values offer the most
precise color control.
Flexibility : RGB/RGBA values are well-suited for programmatic
manipulation.
Intuition : HSL/HSLA can be easier to understand for some users.
h1 {
color: #FF0000; /* Red */
}
p {
color: #333333; /* Gray */
}
a:link {
color: #0000FF; /* Blue */
}
University of Tissemsilt Application Web Development 16 / 40
HSL/HSLA Colors
HSL(hue, saturation, lightness)
Hue : Represents the color itself on a color wheel (0-360 degrees,
where 0 is red and 180 is cyan).
Saturation : color intensity (0% is gray, 100% is full saturation).
Lightness : Controls the brightness of the color (0% is black,
100% is white).
HSLA : Alpha : Represents transparency (0.0 - 1.0, where 0.0 is fully
transparent and 1.0 is fully opaque)
h1 {
color: hsl(0, 100%, 50%); /* Red */
}
.header { /* Green color with 70% opacity */
background-color: hsla(120, 100%, 50%, 0.7);
}
2 Colors in CSS
5 CSS Flexbox
6 Project 01
Property Description Example
Selecting Text :
: :selection : Styles the text that is currently selected by the
user
2 Colors in CSS
5 CSS Flexbox
6 Project 01
Example : CSS Input Formatig
input[type="text"], textarea {
input[type="email"] { width: 100%;
margin-bottom: 10px; /* width : 100% of its
width: 200px; container */
height: 30px; min-height: 100px;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 5px; padding: 10px;
font-size: 16px; font-size: 16px;
} }
2 Colors in CSS
5 CSS Flexbox
6 Project 01
Before the Flexbox
.flex-container {
display: flex;
flex-direction: row;
}
2 Colors in CSS
5 CSS Flexbox
6 Project 01
TP CSS
Create three web pages using flexbox, text formatting, and input
elements :
Login Page
Profile Page
University Information Page
Showcase your skills in design and implementation while focusing on
usability and creativity.
Example : https://github.com/hamdani2023/Flex_ISIL_2024
2 Colors in CSS
5 CSS Flexbox
6 Project 01
About Grid
Grid example
grid-template-columns: repeat(auto-fit,
minmax(100px, 1fr));
*/
grid-template-columns: repeat(3, 1fr);
/*1fr: one fraction*/
gap: 1em;
grid-auto-rows: minmax(100px, auto);
/* define the size of rows */
}