Hi,
I want to know some more about CSS(Cascading Style Sheets). if any tell me websites to helpful on Style sheets. my doubts like below.

howmany version in CSS?
what is z-index?
what is the use of position tag in css?

Dani AI

Generated

Brief, practical answers that expand on the replies by , , and .

CSS "versions"
CSS started with CSS1 (1996) and CSS2 (1998); CSS2.1 was a clarifying update (published as a Recommendation in 2011). Modern CSS is no longer a single monolithic "CSS3"—features are developed as separate modules (Grid, Flexbox, Transforms, etc.) and are released and implemented independently. For a current, module-oriented view of the language see the MDN CSS overview: MDN — CSS.

position (what it does)
The position property controls how an element participates in layout and whether offsets (top, right, bottom, left) apply. Main values:

  • static — default flow, offsets ignored.
  • relative — stays in flow; offsets shift the box visually but original space remains.
  • absolute — removed from flow; positioned relative to nearest ancestor that is not static.
  • fixed — positioned relative to the viewport.
  • sticky — behaves like relative until a scroll threshold, then acts like fixed.
    Short example:
.parent { position: relative; }
.child  { position: absolute; top: 10px; left: 20px; z-index: 10; }

z-index and stacking
z-index sets stacking order (higher values paint on top) but works within stacking contexts. Important points: z-index applies to positioned elements and to flex/grid items; negative values are allowed; however an element cannot escape a parent stacking context — if a parent creates its own context (common triggers: non-auto z-index on positioned elements, transform, opacity < 1, filter, isolation: isolate, etc.), child layering is constrained to that context. When overlaps behave unexpectedly, inspect computed position, z-index, and whether a stacking context exists with the browser dev tools. Relevant reference: MDN — position and MDN — z-index / stacking context.

Recommended Answers

All 3 Replies

CSS comes in 3 Levels and probably the best way to understand it is by taking some time on this link.
Hope it helps you...

I find W3Schools very useful.

the position proerty allows you to specify the number of pixels left/right/up/down you want an element to appear in its containing element. Its used to position most things on the page. Z index refers to what appears on top of other things, creating sort of another layer, coming out of the page. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.