Home arrow Style Sheets arrow Page 6 - Introduction to CSS Positioning Properties Part 1

Introduction to CSS Positioning Properties Part 1

Web designers gained a great deal from the CSS2 specification, especially when it comes to increased flexibility to position HTML elements exactly where they want them within Web pages. Keep reading to learn more.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 11
February 21, 2005
  1. · Introduction to CSS Positioning Properties Part 1
  2. · Basic definitions
  3. · Inline and block boxes
  4. · CSS 2 Positioning Schemes
  5. · The "position" property
  6. · The "display" property

print this article

Introduction to CSS Positioning Properties Part 1 - The "display" property
(Page 6 of 6 )

This property is very handy for redefining the default behavior for inline and block elements, since they can be changed to behave in the opposite way. Let’s say we want a paragraph element, which is, as previously defined, a block-level element, to be displayed as an inline element. We’d write the following line in our CSS declaration:

p {

     display: inline;


That’s all we need to do. Now all of the paragraph elements will behave as inline elements. Similarly, we might turn an inline element into a block-level element. This is often useful for displaying <a> elements to emulate a button appearance in a navigation bar, but there are numerous other hacks. Our CSS code would look something like this:

a.navbar:link {

     /* link properties */

           display: block;


Another common use is to assign an element the "display: none" property, which stops it from being displayed, and completely removes it from the screen space.

Here are the concerned values for the "display" property. There are a number of other possible values, dealing with list, tables, etc. However, for the scope of the article, we’ll detail the following:

display: block;

Sets the selected element to be a block level element.

display: inline;

Sets the selected element to be an inline element.

display: none;

Stops the selected element from being displayed, and doesn’t take up any screen space.

We’re not done yet. There are still more CSS visual properties to be reviewed and useful examples. In the next part of this article, we’ll take a close look at more properties and expose some interesting techniques to manipulate element position in Web documents. Until then, stay tuned.

DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus

- CSS Padding Overview
- CSS: Margins Overview
- Top CSS3 Button Tutorials
- More Top CSS3 Tutorials for Animation and Im...
- CSS Mega Menus: Adding Extra Sections
- CSS Mega Menus
- CSS3 Accordian Menu: Horizontally Display Hy...
- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials