Static Positioning Using CSS

CSS static positioning is the default positioning method for HTML elements. When an element has position: static, it appears in the normal document flow and is not affected by the top, right, bottom, or left properties.

Syntax

selector {
    position: static;
}

Key Points

  • Static positioning is the default value for all HTML elements
  • Elements are positioned according to the normal document flow
  • CSS positioning properties (top, right, bottom, left) have no effect
  • Elements cannot be moved from their natural position

Example: Basic Static Positioning

The following example demonstrates static positioning with a simple layout −

<!DOCTYPE html>
<html>
<head>
<style>
    .container {
        width: 400px;
        border: 2px solid #333;
        padding: 10px;
    }
    .static-box {
        position: static;
        background-color: #4CAF50;
        color: white;
        padding: 20px;
        margin: 10px 0;
        text-align: center;
        top: 50px; /* This will have no effect */
        left: 100px; /* This will have no effect */
    }
    .normal-text {
        background-color: #f0f0f0;
        padding: 15px;
        margin: 10px 0;
    }
</style>
</head>
<body>
    <div class="container">
        <div class="static-box">Static Positioned Element</div>
        <div class="normal-text">This is normal text that flows after the static element.</div>
        <div class="static-box">Another Static Element</div>
    </div>
</body>
</html>
A container with three elements appears: two green boxes labeled "Static Positioned Element" and "Another Static Element", separated by a gray text box. All elements appear in normal document flow, ignoring the top and left properties specified in CSS.

Example: Comparison with Other Position Values

This example shows the difference between static and other positioning methods −

<!DOCTYPE html>
<html>
<head>
<style>
    .demo-container {
        position: relative;
        height: 200px;
        border: 2px solid #333;
        margin: 20px;
        padding: 10px;
    }
    .static {
        position: static;
        background-color: #FF6B6B;
        padding: 10px;
        margin: 5px;
        top: 50px; /* No effect on static */
    }
    .relative {
        position: relative;
        background-color: #4ECDC4;
        padding: 10px;
        margin: 5px;
        top: 20px; /* This works */
        left: 30px; /* This works */
    }
    .absolute {
        position: absolute;
        background-color: #45B7D1;
        padding: 10px;
        top: 10px; /* This works */
        right: 10px; /* This works */
    }
</style>
</head>
<body>
    <div class="demo-container">
        <div class="static">Static (ignores top: 50px)</div>
        <div class="relative">Relative (moved by top: 20px, left: 30px)</div>
        <div class="absolute">Absolute (positioned top: 10px, right: 10px)</div>
    </div>
</body>
</html>
A bordered container displays three colored boxes: a red "Static" box in normal flow (unaffected by positioning properties), a teal "Relative" box shifted down and right from its normal position, and a blue "Absolute" box positioned in the top-right corner of the container.

Conclusion

Static positioning represents the natural flow of HTML elements. Since it's the default behavior, you rarely need to explicitly set position: static unless overriding inherited positioning values.

Updated on: 2026-03-15T14:03:23+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements