Computing Magazine

An Insight into Content Position Management for HTML Pages #Guest

Posted on the 25 July 2014 by Savita Singh @Compgeekblog

Nowadays, HTML has become one of the most used markup languages. No matter what your website development requirement is, HTML allows you to build a web portal that is well in synchronization with your expectations. CSS(Cascading Style Sheet) is a crucial aspect of HTML website development. It basically refers to the style sheet language that is used for describing the look and format of the document that has been written in HTML(Hypertext Markup Language). Primarily designed for enabling the separation of content from presentation, CSS is equipped with elements such as colors, layouts and fonts. Through this post, I’ll be making you familiar as to how CSS module can be utilized for positioning HTML web page elements based on Region boxes.

How exactly can the content/elements be positioned on HTML Pages?

CSS3 supports the positioning of elements in an independent fashion. You can choose to place the elements in any order with one over the other. Before delving into the content position management part, it is absolutely essential to jot down details about the type of pages and content that you’ll be building for the site.

Defining element dimensions is mandatory

Prior to placing an element in your HTML web page design, it is necessary for you to define the dimensions of the element. Every web page has a width of 100% by default, unless you’re interested in modifying the dimensions to something that suits your preferences.

Positioning options available for HTML web page content

Well, before proceeding ahead to the content position management techniques, let me make you aware about the different positioning options you can choose from:

̧ Top- This signifies as to how far the absolutely positioned box’s top margin edge is offset below the top edge of the containing block

̧ Right- This signifies as to how far the absolutely positioned box’s right margin edge is offset to the right edge of the containing block

Left- This signifies as to how far the absolutely positioned box’s left margin edge is offset to the left of the right edge of the containing block

̧Bottom- This signifies as to how far a box’s bottom margin edge is offset above the bottom edge of the containing block.

And now, the methods that can be used for content position management in HTML Pages

1. Relative Positioning


As said before, all the data/content that needs to be positioned on the HTML Pages will be taken as a box that can be moved around. Once you’re aware about the existence of a navigation block, a pull-quote block, a body block and an information block, it would become easy for you to position the content accurately. The created box will be 100% wide and useful for positioning content all across the HTML page. Coming back to relative positioning, it refers to changing the position of this box after the same has been laid out as per the normal flow. If this box has been repositioned, there’s no need for repositioning the subsequent boxes. Here’s how you can define a relative positioned element:


As per the above code, I’ve moved the box left by 100 pixels.

2. Center Positioning

As per this method, the box is explicitly centered in accordance to its containing block. This center positioned element is removed from the normal flow and a brand new containing block is being created for the same. Here is an example of how to define the center positioned element:


3. Absolute Positioning


As per absolute positioning, the box is offset in accordance to the containing block. Quite similar to the case of center positioned element, even the absolute positioned element is removed from the normal flow. Also, there is a possibility of these elements getting overlapped by other elements. Here is an example of how to define an absolute positioned element:


As per above example, I’ve positioned the content to right by 100 pixels.

4. Fixed Positioning

This technique is quite similar to the absolute positioning method, with only one difference that in the fixed positioned element, the containing block is being established by the viewport. Here is an example of how to define the fixed positioned element:


5. Page Positioning


As per this last content positioning technique, the box is explicitly offset in accordance to its containing block. Just like a center positioned element, even a page positioned element creates a new containing block for the normal flow. Here is an example of how to define the page positioned element:



Hope by now you’d have got a better insight on managing the content position for your HTML web pages. Following the right method can help you position the content in a planned and well-organized manner.

Back to Featured Articles on Logo Paperblog