html_css
html_css
html_css
Html :
❖ some html informations:
stands for : hypertext markup language
➢ HyperText: Allows linking to other documents or resources on the web via
hyperlinks.
➢ Markup: Uses tags to define elements within a document. These tags tell
the web browser how to display the content.
<!DOCTYPE html>
➢ <html>: define the root of html document
Audio and Video Support: Native support for embedding audio and
video without the need for external plugins:
2
Improved Form Elements: New input types and attributes for better
form handling:
<input type="date">, <input type="email">, <input type="range">
These features make HTML5 a powerful and versatile tool for modern web
development, enabling richer, more interactive, and more efficient web
applications.
➢
❖ Indentation: in the button of Vs code window your find spaces by default it set
to 4 change it to 2 also in parameter search for tab size and change it to 2
❖ anchor tag with its attributes : target :_blank to open the link in new
page
<a href="https://www.youtube.com/watch?v=G3e-cpL7ofc" target="_blank">Back to
Amazon</a>
❖ Placing element all along the pages : when you create a div and you
wanna place it somewhere in the page we use css for it and the body :
■ css position - flex - grid - margins/paddings /div / positions
❖ Forms
➢ :input to open the link in new page
4
❖html entities :
Entity names or entity numbers can be used to display reserved HTML characters or also
some carachters are not supported from some browser so with html entities we remove
this problem and the char is shown on the screen they begin with & here are the most
famous ones
5
css:
❖ cursor : cursor : pointer ; tji une main quand on met la souris au dessus
❖Pseudo-classes :
Syntax :
selector:pseudo-class {
property: value;
What is it :
❖ 1. Hover :
/* mouse over link */
a:hover {
background-color: blue;
}
➔ hab y9oul ki ndir la souris fou9 l’element hadak dirli hadou changes
❖ 2. Activate :
■ /* selected link */
a:active {
color: #0000FF;
opacity: 0.5
}
6
➔ hab y9oul ki nkliqui 3la l’element mich ghir n7out la souris kima hover
tji une main quand on met la souris au dessus
❖Opacity :
img {
opacity: 0.5;
}
img:hover {
opacity: 0.9;
}
Ici m3nah quand je met la souris au dessus l’opacity de l’image change
➢ box-shadow
❖ text-shadow :
h1 {
text-shadow: 2px 1px 3px #FF0000;
★ 2px :Horizontal offset
★ 1px :Vertical offset
★ 3px :Blur radius (optional)
★ #FF0000 Color of the blur effect
➕
Now if we one appliquer beaucoup de blur effects mn les 4 cotés fou9 taht right left …. on
utilise juste les , look
h2{
color: coral;
text-shadow: -1px 0 rgb(255, 246, 246), 0 1px rgb(252, 246, 246), 1px 0
rgb(252, 249, 249), 0 -1px rgb(243, 242, 242);
}
7
For this result : Hena dar blur mn les 4 directions Just avec Des ,
,
Waw une information en or : c’est avec le shadow qu’on va créer ce border au tour du
texte sinn avec border il va nous créer un box au tour pas comme ca
❖ box-shadow :
div {
box-shadow: 10px 10px 5px lightblue;
}
★ Same for text-shadow this will give :
Now with multiple shadows for only one card just separated with
comma ,
❖
❖ Transition : We have two types of shadow
.join_button{
background-color: white;
color: rgb(44, 57, 241);
border-color:rgb(44, 57, 241) ;
border-style: solid;
border-width: 1px;
padding: 11px 19px;
cursor: pointer;
margin-right: 10px;
transition: background-color 1s , color 1s;
##### Faut mettre dans l’originale here je l’ai pas écrit dans la partie tae hover
pasq ghir nahi la souris yrouh transition
}
.join_button:hover{
background-color: rgb(44, 57, 241);
color:white;
}
9
ou encore ya :
div {
transition: width 2s linear 1s;
}
pour dire ca ;
div {
transition-property: width;
transition-duration: 2s;
transition-timing-function: linear;
transition-delay: 1s;
}
mais la plus utilisé c’est :
div {
transition: width 2s, height 4s;
}
tu selectionne the property que tu veux appliquer l’effet stansition juste ici ya deux
effect just séparer par comma ,
essaie l’effet :
http://127.0.0.1:5500/index.html
❖ Vertical inline property : The vertical-align property in CSS is used to control the
vertical alignment of inline-level and table-cell elements donc les elements li jayin fi star
wahad n3aytolohom inline element s
➢ Common Values :
❖ baseline: Aligns the baseline of the element with the baseline of its parent (default).
❖ middle: Aligns the middle of the element with the middle of the parent element's line height.
❖ top: Aligns the top of the element with the top of the tallest element on the line.
❖ bottom: Aligns the bottom of the element with the lowest element on the line.
❖ text-top: Aligns the top of the element with the top of the parent element's font.
10
❖ text-bottom: Aligns the bottom of the element with the bottom of the parent element's
font.
❖ percentage values (e.g., 50%): Aligns the element relative to its line box based on
❖ the percentage
here what happened is that tweet button bottom ta3ou aligné avec lowest
element in the line
➢ cover - The image keeps its aspect ratio and fills the given dimension. The
image will be clipped to fit
➢ none - The image is not resized
➢ scale-down - the image is scaled down to the smallest version of none or
contain
➔ what do they mean by the aspect ratio ??? : it means that the images will
maintain their original width-to-height ratio, even when resized. This ensures
that the images won't appear stretched or squished.
the solution :
to use object-fit:cover; so when we resize the browser window, the aspect ratio of the
images is preserved resize the browser the images will not be neither shrinked nor
stretched hadi tsa3d bzzzzf f responsiveness
12
❖ 02 :object_position:
The object-position property in CSS is used to set the position of an image within its
container when the object-fit property is used. It allows you to control which part of
the image is displayed within the container when the image is scaled or cropped
more explanation :
object-fit: cover; makes sure the image covers the entire container while
maintaining its aspect ratio. Some parts of the image might be cropped.
object-position determines which part of the image is displayed when it is being
cropped. For ex{ object-position: top left }; will show the top-left part of the image,
while object-position: center; will center the image within the container.
❖ its values :
➢ Keywords: top, bottom, left, right, center
➢ Percentage values: E.g., 50% 50% (which is the default and centers the
image) par rapport aux coordonnés x/y
➢ Length values: E.g., 10px 20px aussi par rapport au cordonnés x/y
➔ so here you have the choice to specify more the text decoration(color/line..) or
tderbi klch fi property wahda text-decoration
➔
⚠️⚠️⚠️⚠️⚠️
➔ so important to pay attention that text-decoration-line is important others
color …… are optional
13
or detailed:
❗ pay attention :
➔ if we set text-decoration:red; it’s false because we forgot to set the line we said color
is optional we can add it but line is obligatory
➔ also we can set more than one text-decoration-line ex :
➢ 01 :text decoration-line :
➢ 01 :text decoration-style :
02 : with text :
➔ P margins : it’s prefarable to set first the margin of all paragraphs to 0 because p by
defaut comes with margins and destroy our page so set them all to 0 than with
classes of your text set the margin that you want
➔ Span: if you wanna decorate just a part of all the text put insed span element and
give it a class name and decorate it as you want
➔ h1 : diri qu’un seul dans tout la page psq hada li y3awn search engine optimisation
(SEO) to found your site
➔ other titles just just with p element than style them
03 : sizes :
➔ instead of setting the height and width use the padding is more professional
06 : Class or element :
➔ the css of class >>>>>from the element lui meme , meme si sbgti f class w b3da the
same element tae hadik class the changes will be applied from the class not the
element
how selectors work in css and how to place things in any area
we want
Fill it later
17
Css-Grid :
CSS Grid Layout Guide | CSS-Tricks : This website has all what you want in grid it’s
just waaw now i leave some main important things to know about grid
How it works: la première chose que tu dois savoir c’est que y’a des styles css qui
📢:
doivent s’écrire dans le container et ya qui doivent s'écrire dans l’item itself faut pas
confondre
● Grid items are placed in rows by default and either span the full width of the grid
container or fits only the size of items depends on display grid or inline-grid
● Generally, both align and justify can be used in a grid container and its items,
depending on the keyword that follows them. When used with self, they apply to the
individual grid item (align-self or justify-self). When paired with content or items,
they apply to the entire grid container (align-items, justify-items, align-content, or
justify-content). The key thing to remember is that align is typically used for vertical
alignment, while justify is for horizontal alignment
see the differences between the self and content and items in the link with photos
you will understand
● in order to name of each column and row you do them when you define the rows
number (same for culumns )
like this :
.container {
18
● You have to put attention when we use repeat or space between two words in
same collarde[ ] it’s not the same here i gave you the simplest naming if you want to
see other check out the link i gave you
● the question is why we define the name of them : when we span a cellule we can do
it just with names instead of with the numbers you’ll see in span
⚠️
we have three methods to do it from the longuest to the smallest
Items can overlap each other. You can use z-index to control their stacking order.
19
method 01 :
➔ grid-column-start
➔ grid-column-end
➔ grid-row-start
➔ grid-row-end
et henna banet mlih why we name the columns and rows to use the here and there they
are very useful
20
method 02 :
➔ grid-column
➔ grid-row
Shorthand for grid-column-start + grid-column-end, and grid-row-start + grid-row-end, respectively.
Ici ils sont separé par / la premiere for start et la deusieme for the end but if you know the
start but you don’t know the end use the keyword span
method 03 :
here an item from that grid is named header and pay attention we are in item section not
container
if you wanna gain time au lieu d’ecrire dans chaque item the name we can name them all
one time only but in the container section not the item like we did below
● Place self : in this example the first for align-self and second for justify-self (self bcz we
are in the item itself) and align always vertically and justify horrizantally
●
22
● 1fr : portion of the remaining space we mean ybda Y9assem grid 9bel b sizing li 3titilou
rem or 25% or px …. and then finally the ramain space li 93ad y9assmou fr
● The order : by default all the items of the container have equal order of 0 if you change
the order of one item to >0 then it will be playced at the end so if item has an order > an
ather item ytplaca baedou
● grid-auto-rows :imagine in game chaque fois le joueur gagne ttzad haja ll grid koun
depacer le nombre de rows précisé it will create another row automatically if we want to
style it mm si mazal il n’a pas gagner mais 5ofna au cas ou ndirou : grid-auto-rows:300px;
just example
●
● grid-auto-flow : we know by default if we don’t precise columns items will be playced in
rows if we want that the flow of item in column we put: grid-auto-flow:column
Html :........................................................................................................................................ 1
❖ some html informations..........................................................................................................1
❖ Indentation ...............................................................................................................................3
❖ anchor tag with its attributes ................................................................................................ 3
❖ Placing element all along the pages place footer as example ........................................3
css:.............................................................................................................................................3
❖ cursor :...................................................................................................................................... 3
❖ Pseudo-classes : Hover & activate ........................................................................................ 4
❖ Opacity :....................................................................................................................................4
❖ Shadow : text shadow and box shadow ............................................................................. 5
❖ Transition ............................................................................................................................... 7
❖ rgba( .. , .. , .. , .. ) ...................................................................................................................... 8
24