inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,870
December 2005
horace
|
Post by Chris on Oct 23, 2017 23:51:24 GMT -8
Yes, as stated that affects every non-block-level content within the container, if you want to affect only the buttons then wrap a container only around the buttons and apply the alignment to that new container: e.g. <div class="button-panel" align="center"><button>b1</button><button>b2</button></div>That is really your preference but just keep in mind that mixing them does have pitfalls because when margins collide there's a phenomenon where one will consume the other leading to unexpected results. An example would be if you have a div with a 25px margin-bottom and another with a 75px margin-top right below it and you would logically assume the space between them to be 100px but not the case, the 75px would overpower the 25px and you end up with only 75px between the two elements. A technique growing in popularity is the Lobotomized Owl which employs the adjacent CSS combinator (+) to accomplish a more well rounded spacing.
|
|
inherit
194230
0
Nov 21, 2015 5:56:42 GMT -8
Alan Vende
4,215
May 2013
l1o2u3i4s5
|
Post by Alan Vende on Oct 24, 2017 9:03:24 GMT -8
Thanks so much, Chris! That worked like I've wanted it to. I asked because on that page, my thought was to put margin-top and margin-bottom onto the paragraph tag for each of the divs, but going off of what you said about them colliding, should I just put margin-bottom on the h3 and then on the paragraph tag? I was going to ask you for a link to the Lobotomized Owl because I had never heard of that before, but I just realized that you supplied a link. Thank you so much for that. I look forward to reading into it further!
|
|