Impostare i margini attraverso il linguaggio CSS è molto semplice , come probabilmente saprete , i margini impostabili sono 4 :
- margin top : speriore
- margin right : destro
- margin bottom : inferiore
- margin left : sinistro
la proprietà CSS che determina i margini è margin capiamo subito come funziona con un esempio :
PAGINA HTML
<!doctype html>
<html lang="it">
<head>
<link rel = "stylesheet" type = "text/css" href = "style.css"/>
</head>
<body>
</body>
</html>
<h1> MARGINI </h1>
<p> questo è un esempio sui margini </p>
STYLE.CSS
h1 {
margin: 75px;
}
Inserendo un solo valore accanto alla proprietà margin , esso sarà assegnato a tutti e 4 i margini.

DIFFERENZIARE I MARGINI SUPERIORE E INFERIORE
PAGINA HTML
<!doctype html>
<html lang="it">
<head>
<link rel = "stylesheet" type = "text/css" href = "style.css"/>
</head>
<body>
</body>
</html>
<h1> MARGINI </h1>
<p> questo è un esempio sui margini </p>
STYLE.CSS
h1 {
margin: 25px 75px;
}
Inserendo due valori , il primo corrisponde ai margini superiori e inferiori , il secondo corrisponde ai margini laterali

DIFFERENZIARE TUTTI I MARGINI
Per differenziare tutti e 4 i margini , l’ ordine di inserimento è : superiore , destro , inferiore , sinistro.
PAGINA HTML
<!doctype html>
<html lang="it">
<head>
<link rel = "stylesheet" type = "text/css" href = "style.css"/>
</head>
<body>
</body>
</html>
<h1> MARGINI </h1>
<p> questo è un esempio sui margini </p>
STYLE.CSS
h1 {
margin: 25px 75px 10px 50px;
}
