Absolute Positioning in CSS – Learn CSS positioning

What is “position:absolute” in CSS ? To learn absolute positioning CSS property you must understand block level & inline elements, normal flow concept of CSS. You must know normal flow first, then learn absolute position concept.


Box model, Normal Flow > Absolute positioning


Absolute Positioning Explained

  1. An absolutely positioned element is removed from the normal flow. This positioning scheme applies to any element that has its position porperty absolute or fixed.
  2. This means you can put it anywhere, and it won’t affect or be affected by any other element in the flow.
  3. Normally absolutely positioned elements are positioned by the top and left property assigned to them.
  4. This top and left works with respect to the container block of this absolutely positioned element. This top and left are called offset positions.
  5. Absolute positioning always works w.r.t the container block of this absolutely positioned element.
  6. Absolute elements create a new coordinate system for child elements inside them.
  7. This is an exellent property of ABSOLUTE POSITIONING : Use all four offset properties (TOP, LEFT, BOTTOM, RIGHT), and you can stretch an element without defining any width or height—it’s bound only by its parent element or the document itself if there is no container.

Continue reading “Absolute Positioning in CSS – Learn CSS positioning”

Centering text using CSS, Center inline & block DIV elements

Inline & Block elements >> Centering HTML elements

In this article I have describe which HTML elements are inline elements and which are block level HTML5 elements. How to center inline elements inside a container DIV or block level elements.

Centering text & inline elements

IMG, STRONG, SPAN elements in a webpage are examples of inline elements. Alos I have used the term inline content, which means inline elements. Inline content includes such things as text, images, <strong> and <span> tags. Now we need to center inline content inside a block element (Normally Inline elements resides inside a BLOCK element like DIV, H1 etc)

Just use text-align property applied to the next higher level block level container with the content to be aligned inside. Continue reading “Centering text using CSS, Center inline & block DIV elements”

CSS Tutorial on Two column DIV layout problem where container DIV collapses

Here container DIV has two child DIVs. Container DIV is relatively positioned. After container DIV a footer DIV BOX exists which also relatively positioned. Inside container DIV there exists two column DIVs which are absolutely positioned. Left colummn is of 60% width of container and right column is of 30% width.
Continue reading “CSS Tutorial on Two column DIV layout problem where container DIV collapses”

CSS circles – draw concentric Circles using CSS3

This is a CSS tutorial to draw concentric circles using pure CSS. Here Web Developer Mr Choudhury shown with free source code examples, the easiest ways to draw CSS circles & concentric circles with the help of pure CSS. Here DIV represent each circle having border-radius:50%;.

About this tutorial & author : Also Mr. Choudhury shown the formula, and he described and explained here developed by the renowned CSS layout expert and css template designer for web page layouts.

Continue reading “CSS circles – draw concentric Circles using CSS3”

Vertical centering using CSS- when child DIV placed in a ‘container DIV of fixed height’

Vertically center a DIV inside a container DIV element. The container can be relatively positioned. The child DIV should be absolutely positioned and its top, right, bottom, and left offset properties specify the element’s position w.r.t the container block (what the element is positioned relative to) and this value should be 0. So now use these properties to vertically center a DIV inside a container DIV element. Continue reading “Vertical centering using CSS- when child DIV placed in a ‘container DIV of fixed height’”

When container DIV collapses having multiple child DIV inside it

When container DIV collapses having multiple child DIV inside it. Here you will get a case study when container DIV has two child divs side by side they appears inside container DIV. Child DIVs are absolutely positioned inside a container DIV which is relatively positioned. Also know how to recover from the problem. Continue reading “When container DIV collapses having multiple child DIV inside it”