<main class="main container">
<section class="section position-static">
<h2><code>position: static;</code></h2>
<div class="static box"></div>
<p>The above box has <strong><code>position: static;</code></strong></p>
</section>
<p>This is the default position, and the <code>div.static</code> element is placed in the normal flow of document.</p>
<p><code>left, right, top, bottom, z-index</code> properties cannot be applied to elements with position <code>static</code>.</p>
<p>In the above example, the box is placed <br />
<strong style="display: inline-block; margin-top: 0.1rem; padding: 0.5rem 1rem; background-color:yellowgreen;">
<code>
div.relative {
position: static; /* No need to mention as it's the default value*/
}
</code>
</strong>
</p>
</main>
.main > p {
text-align: center;
margin-bottom: 1rem;
font-size: 1.1rem;
}
.section {
padding: 1rem;
margin: 2rem auto;
max-width: 400px;
background-color: lightskyblue;
/* text-align: center; */
color: white;
max-width: 100%;
}
.section h2 {
font-size: 1.3rem;
background-color: darkgreen;
padding: 1rem;
}
.section p {
font-size: 1.1rem;
background-color: darkgreen;
padding: 1rem;
}
.section .box {
background-color: navy;
width: 200px;
height: 200px;
margin: 2rem 0;
}
section.position-static .static {
position: static;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.