Best Windows Hosting

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

Thursday, 24 May 2012

Positioning Property and Z-Index in CSS

Posted on 08:21 by Unknown
The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element's content is too big.

Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method.

There are four different positioning methods:

1. Static Positioning

HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Static positioned elements are not affected by the top, bottom, left, and right properties.

2. Fixed Positioning

An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled:
p
{
position:fixed;
top:30px;
right:5px;
}

Fixed positioned elements are removed from the normal flow. The document and other elements behave like the fixed positioned element does not exist.

3. Relative Positioning

A relative positioned element is positioned relative to its normal position.

h2
{
position:relative;
left:-20px;
}
or
h2
{
position:relative;
left:20px;
}

The content of relatively positioned elements can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow.

4. Absolute Positioning

An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html>

h2
{
position:absolute;
left:100px;
top:150px;
}

Absolutely positioned elements are removed from the normal flow. The document and other elements behave like the absolutely positioned element does not exist. Absolutely positioned elements can overlap other elements.

Z-INDEX Property (Overlapping Elements)

The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order.

Note: z-index only works on positioned elements (position:absolute, position:relative, or position:fixed).

img
{
position:absolute;
left:0px;
top:0px;
z-index:-1;
}
Read More
Posted in CSS | No comments
Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • 13 Things to keep in mind before using DLL in Delphi
    Keep in mind the following tips when writing your DLL: 1. Make sure you use the proper calling convention (C or stdcall). 2. Know the correc...
  • How to use TADOTable in Delphi XE2?
    Following is the code snippet which will show you how to use TADOTable in Delphi XE2? procedure TClass1.GetDataFromADOTable; begin   try    ...
  • How to use FindComponent function in Delphi XE2?
    Following is the code snippet which will show you how to use FindComponent in Delphi XE2? procedure TClass1.UseFindComponent(FieldName : str...
  • Online Finance Degrees
    There is a great demand for professionals with profound knowledge of finance and accounting in most of the reputed banks and financial insti...
  • How to grab the recruiter’s attention with your resume?
    Did you know that the average recruiter spends about 8 to 10 seconds glancing at your resume before s/he moves on to the next? So, whether y...
  • 5 ways to handle workload at your workplace
    With bigger workloads, tighter deadlines and more pressure, the temptation to pack in as many tasks as possible is hard to resist. But juggl...
  • Online Marketing Degrees
    Because global competition has become so intense, it should come as no surprise that companies invest heavily in their marketing and promoti...
  • Frameset, Frame and IFrame Elements in HTML
    Frame Element With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and...
  • Oracle Streams: An Overview
    Oracle Streams enables information sharing. Each unit of shared information is called a message. The stream can propagate information within...
  • Phonegap: An amazing combination of HTML5, CSS3 and Javascript
    Phonegap (Cordova) = HTML5 + CSS3 + Javascript What a great combination!! How easy is Phonegap to learn!!! A great enhancement in mobile tec...

Categories

  • AJAX
  • C++
  • CSS
  • Delphi
  • DOTNET
  • HTML
  • Javascript
  • jQuery
  • Management
  • Online Degrees
  • Oracle
  • Others
  • Phonegap
  • PHP
  • Unix
  • XML

Blog Archive

  • ▼  2012 (155)
    • ▼  September (64)
      • Online Music Degrees
      • Online Accredited Degrees
      • Online Advertising Degrees
      • Online Finance Degrees
      • Online Marketing Degrees
      • Online Forensic Science Degrees
      • Online DBA (Database Administrator) Degrees
      • Online Biology Degrees
      • Online Geography Degrees
      • Online History Degrees
      • Online Art Degrees
      • Online Sports Degrees
      • Online Agriculture Degrees
      • Online Library Science Degrees
      • Online Environmental Science Degrees
      • Online Business Degrees
      • Online Physical Education Degrees
      • Online Science Degrees
      • 5 Tips to enjoy your workplace
      • 5 E-mail Etiquette You Must Know
      • How to grab the recruiter’s attention with your re...
      • 30 Facts About Google Adsense You Must Know
      • Working of the JSP Container
      • List of 70 basic commands of UNIX
      • 13 Point comparison between SQL and PLSQL
      • 10 Rules of Operator Overloading in C++
      • 6 Point comparison between Apache and IIS Web Servers
      • 5 Qualities of a good manager
      • Never try to fake your Resume / CV
      • How to write a cover letter of your resume?
      • The crucial first 5 minutes of an Interview
      • Rejected in an Interview? Don't Lose Your Heart
      • 6 FAQ’s in an interview
      • 5 ways to get into the good books of the boss
      • 5 Reasons to Quit Your Job
      • Online Web Designing Degrees
      • Online BBA Degrees
      • Online MA Degrees
      • Online BA Degrees
      • Online Human Resource (HR) Degrees
      • Online Graduate Degrees
      • Online Master Degrees
      • Online Fashion Design Degrees
      • Online Bachelor Degrees
      • Onlin PhD Degrees
      • Online Nursing Degrees
      • Online MBA Degrees
      • Online Doctorate Degrees
      • Online Psychology Degrees
      • Online Social Science Degrees
      • Online Law Degrees
      • Online Accounting Degrees
      • Online Medical Degrees
      • Online Engineering Degrees
      • Online Professional Degrees
      • 3 Things to keep in mind while you quit your job
      • Planning a job change? Tips to negotiate salary
      • How to use SaveToFile and LoadFromFile in Delphi XE2?
      • How to use TADODataset, TDatasource and TDBGrid in...
      • Embarcadero HTML5 Builder Features List
      • 5 ways to handle an interview over a video call
      • List of 8 job interview goof-ups
      • Anatomy of the commonly asked interview question “...
      • Use Social Networking Sites To Groom Your Career
    • ►  August (11)
    • ►  July (4)
    • ►  June (3)
    • ►  May (25)
    • ►  April (48)
Powered by Blogger.

About Me

Unknown
View my complete profile