forms displays position Z-index overflow compensators pseudo class and pseudo elements Comment,
- Siddharth Sharma
- Feb 26, 2025
- 3 min read
Here’s a breakdown of the terms you mentioned in CSS:
1. Forms in CSS
Forms consist of elements like <input>, <select>, <textarea>, and <button>.
Styling forms involves using CSS properties such as border, padding, font-size, and background.
Pseudo-classes like :focus, :hover, and :disabled are commonly used to style form elements dynamically.
2. Displays in CSS
The display property controls how an element is rendered.
Common values:
block: Takes up the full width available.
inline: Stays in line with other elements.
inline-block: Similar to inline but allows setting width and height.
flex: Enables flexible box layout.
grid: Enables grid-based layout.
none: Hides the element.
3. Position in CSS
The position property determines how an element is positioned in the document.
Common values:
static: Default positioning.
relative: Moves relative to its normal position.
absolute: Positioned relative to the nearest positioned ancestor.
fixed: Stays fixed relative to the viewport.
sticky: Sticks to a position until a scroll event moves it.
4. Z-Index in CSS
The z-index property controls the stack order of elements.
Higher z-index values place elements above those with lower values.
Only works on positioned elements (relative, absolute, fixed, or sticky).
5. Overflow in CSS
The overflow property handles content that exceeds the element's box.
Common values:
visible: Content overflows outside.
hidden: Content is clipped.
scroll: Always shows scrollbars.
auto: Shows scrollbars only when needed.
6. Compensators in CSS
There is no direct "compensators" property in CSS.
The term might refer to techniques for handling layout issues, like:
Using min-height or max-width to prevent overflow.
Utilizing flexbox or grid to ensure elements adjust dynamically.
7. Pseudo-Class in CSS
Pseudo-classes define a special state of an element.
Common examples:
:hover: When the user hovers over an element.
:focus: When an element gains focus.
:nth-child(n): Selects elements based on their position.
8. Pseudo-Element in CSS
Pseudo-elements allow styling specific parts of an element.
Common examples:
::before: Adds content before an element.
::after: Adds content after an element.
::first-letter: Styles the first letter of a block.
::first-line: Styles the first line of a block.
9. CSS Comments
CSS comments are used to document code and improve readability.
Syntax:
/* This is a CSS comment */
1. Forms in CSS
Forms contain input elements like text fields, checkboxes, and buttons. CSS can be used to style them.
Example:
cssinput { width: 100%; padding: 10px; border: 1px solid #ccc; } input:focus { border-color: blue; }html<form> <input type="text" placeholder="Enter your name"> <button>Submit</button> </form>2. Display in CSS
The display property determines how an element is rendered on the page.
Example:
css.block-element { display: block; width: 200px; background: lightblue; } .inline-element { display: inline; color: red; }html<div class="block-element">Block Element</div> <span class="inline-element">Inline Element</span>3. Position in CSS
Defines how an element is positioned in the document.
Example:
css.relative-box { position: relative; left: 20px; }
.absolute-box { position: absolute; top: 50px; left: 50px; background: yellow; }html<div class="relative-box">Relative Position</div> <div class="absolute-box">Absolute Position</div>4. Z-Index in CSS
Controls the stacking order of elements. Higher values appear in front.
Example:
css.box1 { position: absolute; background: red; width: 100px; height: 100px; z-index: 2; }
.box2 { position: absolute; background: blue; width: 100px; height: 100px; left: 30px; top: 30px; z-index: 1; }html<div class="box1"></div> <div class="box2"></div>5. Overflow in CSS
Determines how content behaves when it exceeds its container.
Example:
css.container { width: 200px; height: 100px; overflow: scroll;
border: 1px solid black; }html<div class="container"> This content is very long and will need a scrollbar to be visible. </div>6. Compensators in CSS
Not a direct CSS property, but refers to layout adjustment techniques like flexbox.
Example using Flexbox:
css.container { display: flex; justify-content: space-between; } .item { width: 100px; background: lightgray; }HTML
<div class="container"> <div class="item">Item 1</div> <div class="item">Item 2</div> </div>7. Pseudo-Class in CSS
A pseudo-class selects elements based on their state.
Example:
css
a:hover { color: red; } input:focus { border: 2px solid green; }html
<a href="#">Hover over me</a> <input type="text" placeholder="Click to focus">8. Pseudo-Element in CSS
A pseudo-element styles specific parts of an element.
Example:
css
p::first-letter { font-size: 2em; color: blue; } p::before { content: "🔹 "; color: red; }html
<p>This is a paragraph with pseudo-elements.</p>9. CSS Comments
Used to add explanations in CSS.
Example:
html
/* This is a comment / p { color: green; / Change text color */ }



Comments