You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>In your CSS file, write the following code:</p>
68
68
<preclass="code-block">
69
69
<code>
70
-
.box {
71
-
width: 200px;
72
-
height: 100px;
73
-
background-color: #4E4E4E;
74
-
margin: 20px;
75
-
}
70
+
.box {
71
+
width: 200px;
72
+
height: 100px;
73
+
background-color: #4E4E4E;
74
+
margin: 20px;
75
+
}
76
76
</code>
77
77
</pre>
78
78
<p>This code defines a <codeclass="inline-code">.box</code> class with a <codeclass="inline-code">width</code> of <codeclass="inline-code">200px</code>, a <codeclass="inline-code">height</code> of <codeclass="inline-code">100px</code>, a <codeclass="inline-code">background-color</code>, and a <codeclass="inline-code">margin</code> of <codeclass="inline-code">20px</code> on all sides. The margin creates space around the <codeclass="inline-code">.box</code> element, pushing it away from other elements and the edges of its container.</p>
79
79
<p>Apply the .box class to an HTML element and view the result in your browser to see the margin effect:</p>
<p>Apply the <codeclass="inline-code">.box</code> class to an HTML element and view the result in your browser to see the padding effect:</p>
103
103
<preclass="code-block">
104
104
<code>
105
-
<div class="box">Content inside the box</div>
105
+
<div class="box">Content inside the box</div>
106
106
</code>
107
107
</pre>
108
108
<p>Select the CSS and HTML in your editor and refresh your browser to observe how the padding impacts the layout and the spacing within the element!</p>
<p>Apply the <codeclass="inline-code">.box</code> class to an HTML element and view the result in your browser to see the effect of the custom properties:</p>
132
132
<preclass="code-block">
133
133
<code>
134
-
<div class="box">Content inside the box</div>
134
+
<div class="box">Content inside the box</div>
135
135
</code>
136
136
</pre>
137
137
<p>Select the CSS and HTML in your editor and refresh your browser to observe how the custom properties impact the styling of the element. Try changing the values of the variables to see how it updates the design throughout your stylesheet!</p>
0 commit comments