{ LearnWebSiteDesign.com }
HTML, XHTML CSS Tutorials and Free Website Templates
CSS Positioning Tutorials
CSS allow you to position HTML elements within your web pages and HTML elements within other HTML elements. You can also overlap HTML elements on top of or below other HTML elements.
There are 4 different types of positioning methods and 1 method of overlapping HTML elements.
The 4 positioning methods are listed below:
| Method | Description |
|---|---|
| Static Positioning | HTML elements are have a static position by default. This means that they appear one after another in the web page. |
| Fixel Positioning | An HTML element with a fixed position is positioned relative to the web browser window. |
| Relative Positioning | An HTML element with a relative position is positioned relative to its normal position. |
| Absolute Positioning | An HTML element with a position of absolute is positioned relative to the first parent element that has a position that is not static. If there is no such element, the containing block is <html>. |
The overlapping method is listed below:
| Method | Description |
|---|---|
| Overlapping | HTML elements can be stacked on top of or below of other HTML elements. |
To understand positioning in CSS, you must have an understanding of the box model. Every HTML element, including the <html> element, is considered a rectangular container that can have content within it. Every HTML element has a margin, padding and a border.
CSS Static Positioning
HTML elements are have a static position by default. This means that they appear one after another in the web page also called appearing in the normal flow of content.
HTML elements can have a static position by one of two ways: by including the position property with a value of static within the selector of the HTML element or by simply not including the position property.
The code example below shows you how HTML elements are positioned statically without including the position property.
The web page that the code example creates is here: CSS Positioning Example.
Absolute Positioning
Absolute positioning is used to place an HTML element is a specific place within a web page relative to the first containing parent element that has a position other than static. If there is no other such elememt, the <html> element becomes the parent containing block.
The code example below shows you how HTML elements are placed within a web page using absolute positioning. The <html> element is the containing block in this example.
The web page that the code example creates is here: CSS Positioning Example.
The code example below shows you how HTML elements are placed within a another HTML element.
The web page that the code example creates is here: CSS Positioning Example.
Relative Positioning
Relative positioning allows you to position HTML elements relative to where they would ordinally be placed within the flow of content
The web page that the code example creates is here: CSS Positioning Example.
Fixed Positioning
Fixed positioning allows you to position an HTML element in a fixed position within the web page, even if the web page is being scrolled.
NOTE: Internet Explorer supports the fixed value only if a !DOCTYPE is specified.
NOTE: Internet Explorer 6 does not support fixed position. There are some workarounds to this problem and some of them will be explained in this tutorial at a later date.
The code example below shows you how to position HTML elements in a fixed position on the web page.
The web page that the code example creates is here: CSS Positioning Example.
Overlapping Elements
CSS allows you to layer positioned HTML elements on top of and below one another along an invisible z-axis using the z-index property. The z-axis is the an imaginary line along the computer window. The z-index property allows you to position HTML elements on top and below the z-axis if the HTML elements are positioned relative, absolute or fixed.
The z-index property and its' values are listed below.
| Property | Values |
|---|---|
| z-index | auto, integer |
The code example below shows you how to position an HTML element using the z-index property with a negative value.
The web page that the code example creates is here: CSS Positioning Example.
The code example below shows you how to position an HTML element using the z-index property with a positive value.
The web page that the code example creates is here: CSS Positioning Example.
Tutorials
Templates
References
Sponsors
You can get your website online using Velnet, a leading UK web hosting provider. They provide free template and installation for WordPress blogs. Discuss webmaster related topics at Webmaster Serve, a Webmaster SEO forum
SouthernWebGroup.com provides high quality website design in Atlanta, GA as well as around the world.
Find low cost cheap website hosting and domain registration.
Browser our free no ads web hosting directory and find the free web hosting that's right for you and your budget.
Advertise your web design and web development related products and services here.
- Web Hosting UK
- Web Design Manchester
- Cheap Web Hosting
- free website hosting reviews
- ecommerce design
- Advertise
Recommended
Download free css web hosting templates that are easy to edit at FreeWebHostingTemplates.com.
Friends
- free web hosting templates
- free web hosting templates
- free web hosting reviews
- Web Development
- HD Wallpapers
- best web hosting providers
- Web Hosting Blog
- domain names
- iPage Host Reviews
- Reliable Bluehost Reviews
- Programming Forum
- Alojamento Web
- criar sites
- Free Facebook Banners
- Free No Ads Web Hosting Reviews
- Cheap Web Hosting Reviews
- Free Web Hosting Templates
- Free Premium Wordpress Themes
- Free Premium Wordpress Themes
- Free Joomla Template
- Free Wordpress Themes
- Best Android Apps
- Wordpress Themes Gallery
- Information technology courses
- Free PSD Files