1<div class="myClass" style="margin-top: 20px;">
2<div class="myClass">
3<div class="myClass" style="margin-bottom: 20px;">
1/* La propriété s'applique aux quatre côtés */
2margin: 1em;
3
4/* vertical | horizontal */
5margin: 5% auto;
6
7/* haut | horizontal | bas */
8margin: 1em auto 2em;
9
10/* haut | droit | bas | gauche */
11margin: 2px 1em 0 auto;
12
13
14/* Valeurs globales */
15margin: inherit;
16margin: initial;
17margin: unset;
18
1/* Apply to all four sides */
2margin: 1em;
3margin: -3px;
4
5/* vertical | horizontal */
6margin: 5% auto;
7
8/* top | horizontal | bottom */
9margin: 1em auto 2em;
10
11/* top | right | bottom | left */
12margin: 2px 1em 0 auto;
13
14/* Global values */
15margin: inherit;
16margin: initial;
17margin: unset;
1/*hey guys if you have doubt how absolute property works, it works in way that
2it comes out of the 'document flow' i.e) just consider two div elements in
3which each a size of a box, say that you need two place the second box over the
4top box simple just give it absolute position such that the second div
5positioned itself with respect to the browser window, you can move the element
6anywhere in the window*/
7div{
8 position:absolute;
9 top:10px; /*it pushes away div element from top 10px down Remember with
10 browser window*/
11 left:20px;
12 right:10px;
13 bottom:20px;
14 /*last three property excatly similar to top property it just pushes away
15 from specified direction*/
16}
17Wondering how to use absolute property within a div simple?
18Say you have a div inside a div. /*most case scenario*/
19putting first div relative and mentioning second div absolute will do the job
20In my early days of css, I wonder the position property with relative and no top
21bottom, right left property with it. One day I realized it.
22/*highly recommed you to run the following code two know the difference*/
231st)<div class='b'>
24 <div class="b1">
25 content
26 </div>
27 </div>
28<style>
29.b {
30 height: 200px;
31 width: 200px;
32 display: flex;
33 justify-content: center;
34 align-items: center;
35 background-color: rgb(201, 14, 14);
36 position: relative;
37}
38
39.b1 {
40 height: 100px;
41 height: 100px;
42 width: 100px;
43 position: absolute;
44 top: 50%;
45 left: 50%;
46}
47/*do it and see*/
482nd)<div class="b1">
49content
50</div>
51<style>
52.b1 {
53 height: 100px;
54 height: 100px;
55 width: 100px;
56 position: absolute;
57 top: 50%;
58 left: 50%;
59}
601st with reference to the first div
612nd to refrence to the object window
62Wondering Why i use div for all my tags, simple due its flexibilty to be an
63comman container
64</style>
65 ---By Siddharth -a physics undergraduate.
66