When I adjust the padding and margin, is the pixel change happening vertically or in all directions? I changed the box from 10 to 20px and I fooled around on sololearn and couldnt get the box how I wanted

  .injected-text {
    margin-bottom: -25px;
    text-align: center;

  .box {
    border-style: solid;
    border-color: black;
    border-width: 5px;
    text-align: center;

  .yellow-box {
    background-color: yellow;
    padding: 10px;
  .red-box {
    background-color: crimson;
    color: #fff;
    padding: 20px;

  .blue-box {
    background-color: blue;
    color: #fff;
    padding: 10px;
<h5 class="injected-text">margin</h5>

<div class="box yellow-box">
  <h5 class="box red-box">padding</h5>
  <h5 class="box blue-box">padding</h5>

padding1 padding2 padding3

When you use shorthand property of padding and margin with one value on block-level elements. Value affects all directions.

Read more:

  1. https://www.w3schools.com/css/css_margin.asp
  2. https://www.w3schools.com/css/css_padding.asp
1 Like