I'm writing a Terms of Use page using Materialize.css, which is contained within a card-panel
. I find that 'as-is', the spacing at the top is too much:
Here, the margin-top
of the h4
element get added to the padding
of the containing card-panel
, which is 24px. I think the former is actually sufficient spacing by itself from the top of the shadowed box, so I tried setting padding-top
of this card-panel
to zero using the following SCSS rule:
.lucy-terms {
.card-panel.lucy-card-panel {
padding-top: 0;
}
}
However, with this enabled, I find that the spacing becomes too small:
When I highlight it, it seems like the margin-top
of the h4
element falls outside the box. Shouldn't the margin
of the element fall within the containing element? How can I fix this?
I've included the relevant snippet below.
body {
background-color: #f3f3f3;
}
.card-panel.lucy-card-panel {
padding-top: 0;
}
<html>
<head>
<!-- Materialize.css -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>
</head>
<body>
<div class="container lucy-terms">
<div class="row">
<div class="col s12 m12">
<div class="card-panel lucy-card-panel">
<div class="card-content">
<h4 class="center-align">Terms of Use</h4>
<p class="flow-text uppercase">PLEASE NOTE THAT YOUR USE OF AND ACCESS TO OUR SERVICES (DEFINED BELOW) ARE SUBJECT TO THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO ALL OF THE FOLLOWING, YOU MAY NOT USE OR ACCESS THE SERVICES IN ANY MANNER.</p>
<p class="flow-text">Effective date: April 2, 2018</p>
</div>
</div>
</div>
</div>
</body>
</html>