<div class="example">
  <section class="panel">
    <header class="panel__header">
      <h1 class="panel__title">
        Panel on a white background
      </h1>
    </header>
    <div class="panel__content">
      The subtle gray for this panel contrasts against white just enough to clearly delineate this panel as its own content section.
    </div>
  </section>
</div>

<div class="example light-grey-bg">
  <section class="panel">
    <header class="panel__header">
      <h1 class="panel__title">
        Panel on a light gray background
      </h1>
    </header>
    <div class="panel__content">
      The transparent gray gets a little darker on this background.
    </div>
  </section>
</div>

<div class="example light-grey-bg-2">
  <section class="panel">
    <header class="panel__header">
      <h1 class="panel__title">
        Panel on a slightly darker gray background
      </h1>
    </header>
    <div class="panel__content">
      And even darker on this background so it still stands out.
    </div>
  </section>
</div>
:root {
  --panel-color: rgba(0, 0, 0, 0.135);
  --panel-border-width: 0.1em;
  --panel-padding: 0.75em;
}

.panel {
  background: var(--panel-color);
  border-radius: var(--panel-border-width);
  padding: var(--panel-border-width);
}

.panel__header, 
.panel__content {
  padding: var(--panel-padding);
}

.panel__title {
  line-height: 1;
}

.panel__content {
  background: #fff;
}

/**
 * The styles below are unrelated to this demo and are just for scaffolding purposes.
 */

* {
  font-family: sans-serif;
  line-height: 1.4;
  margin: 0;
  padding: 0;
}

html {
  height:100%;
  display: flex;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}

.example {
  display: flex;
  flex-grow: 1;
  padding: 1em max(1em, calc(50vw - 35ch));
  place-items: center;
}

.example > * {
  flex-grow: 1;
}

.light-grey-bg {
  background: #eee;
}

.light-grey-bg-2 {
  background: #ddd;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.