0

I am working on an example in w3schools.com in the chapter of advanced CSS - Shadows -> CSS - Box Shadows. I understand the flow of the code except for one detail. How is the height determined of the text card. If I comment out padding: 10px in two areas the height decreases by a lot more than 10px.

div.card {
  width: 250px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  text-align: center;
}

div.header {
  background-color: #4CAF50;
  color: white;
  padding: 10px;
  font-size: 40px;
}

div.container {
  padding: 10px;
}
<h1>Create Cards</h1>

<p>The box-shadow property can be used to create paper-like cards:</p>

<div class="card">
  <div class="header">
    <h1>1</h1>
  </div>

  <div class="container">
    <p>January 1, 2021</p>
  </div>
</div>

Thanks for any help.

Temani Afif
  • 245,468
  • 26
  • 309
  • 415

0 Answers0