Use the position property to position an html element. An element may be positioned relative to the other elements in its containing element. Or an element may be positioned absolute within its containing element.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site
Your Ad Here!
Your ad here for one full year, only $20. Send me your ad copy, up to six lines, I'll post it ASAP. After you inspect your ad online, you can pay through PayPal.
Click here for more information.

Set an Element's Position

Use the position property to position an html element. An element may be positioned relative to the other elements in its containing element:

position:relative;

Or an element may be positioned absolute within its containing element:

position:absolute;

After setting the type of positioning, use the left and top properties to set the position of the element.

Text in a Span Positioned Relative

The span containing the text above is positioned relative with its left side 10 pixels from the left side of its containing element and its top side 10 pixels from the top of its containing element.

<span style="position:relative; left:10px; top:10px; color:#0000ff">Text in a Span Positioned Relative</span>



Some text before the span element. Text in a Span Positioned Relative Some text after the span element.

The span containing the text above is also positioned relative with left:10px, top:10px. Note how relative positioning allows the span to flow into position with the text before and after the span element.


Some text before the span element. Text in a Span Positioned Absolute Some text after the span element.

The span containing the text above is positioned absolute with left:10px, top:10px. Note how absolute positioning places the span at the exact position defined within its containing element, ignoring other elements that follow the default flow pattern.

Some text before the span element. <span style="position:absolute; left:10px; top:10px; color:#0000ff; z-index:0;" >Text in a Span Positioned Absolute</span > Some text after the span element.

- Note: The containing element for an absolutely positioned element is its closest, positioned ancestor. For example, you might define position:absolute for an element in order to possiton it at an exact location inside its containing block. Then define position:relative for a containing element so that it follows normal flow in the webpage layout. If you don't explicity define a position type, either position:relative or position:absolute for anabsolute positioned element's parent element, the absolute positioned element will be positioned absolute relative to the body of the webpage.

- Use width, and height with or without left and top to set the size of an element.

Web Design Sections
CSS Quick Reference
Use Inline Style
Use an Embedded Style Sheet
Use an External Style Sheet
CSS Units of Measurement
Specifying Color
Set the Text Color
Set the Text Alignment
Set the Letter Spacing
Set the Word Spacing
Set the Line Spacing
Highlight Text
Indent the First Line of Text
Set the Text Decoration
Set Text Justification
Set the Font Family
Set the Font Style
Set the Font Boldness
Set the Font Size
Set the Font Variant
Style the First Letter
Style the First Line
Set the Background Color
Set a Background Image
Set a Background Image's Position
Set a Fixed Background Image
Set the Background Properties
Set the Border Properties
Set the Border Style
Set the Border Width
Set the Border Color
Set an Element's Margin
Set an Element's Padding
Set an Element's Clipping
Set an Element's Overflow
Set an Element's Position
Set an Element's Float
Color the Scrollbar
Set an Element's Overlap
Set an Element's Visibility
Vertical Align an Element
Define CSS Rollover Effects
Web Designer's Reference
Your Ad Here
[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269