+ 3
What Are The 3 Ways By Which Margins Can Be Set Over A Div Using CSS?
Put up the rules / stylings / codes by which it can be done.
3 Answers
+ 7
Maybe this could help you:
https://code.sololearn.com/W6qLHyeVSHaI/?ref=app
+ 7
That was because of your "3 ways": I was thinking you're possibly be confusing (as a lot of people) between margin/padding (and transparent border could be the 3rd "ways" to set margin ^^ (notice that I previously wrote: "maybe" ;))
So, maybe you ask for the different shorthanded css notation? (but there's 4, in this case ;P)
/* with only one value, apply for top, right, bottom and left */
margin: 10px;
/* with two values, first one is for vertical (top and bottom), second for horizontal (left and right) */
margin: 10px 20px;
/* with three values, first for top, second for horizontal (left and right), third for bottom */
margin: 10px 20px 30px;
/* with four values, the order is from top and clockwise turn: top, right, bottom, left */
margin: 10px 20px 30px 40px;
0
That's an interesting demonstration @visph, but I wasn't asking of the differences between MARGIN, PADDING & BORDER.
You can refer to the question again. :)