Style Sheets
  Home arrow Style Sheets arrow Page 6 - CSS Shorthand at a Glance
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
VeriSign Whitepapers 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

CSS Shorthand at a Glance
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 17
    2005-02-08

    Table of Contents:
  • CSS Shorthand at a Glance
  • Basic CSS rules
  • Font shorthand property
  • Background shorthand property
  • Margin shorthand property
  • Padding shorthand property
  • Border shorthand property
  • List-style shorthand property

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    CSS Shorthand at a Glance - Padding shorthand property


    (Page 6 of 8 )

    The "padding" shorthand property syntax is similar to that specified for margins:

    padding: padding-top | padding-right | padding-bottom | padding-left;

    Padding properties set the size of the padding between the inside of an element’s border (if any) and the element itself.

    Here are some examples:

    p {

         padding: 10px;

    }

    p {

         padding: 10px 20px;

    }

    p {

         padding: 10px 20px 10px;

    }

    p {

         padding: 10px 20px 10px 20px;

    }

    Similar to margin properties, when only one value is given for the element, that value will be applied to each padding, in the following manner: "padding-top," "padding-right," "padding-bottom" and "padding left."

    Taking a look at the second example, two values are defined. CSS will give the first value for "padding-top" and "padding-bottom." The second value will be assigned for "padding-right" and "padding-left."

    The third example defines three padding values for the element. They will be evaluated by assigning the first value for "padding-top," the second for "padding-right," and the last for "padding-bottom."

    Finally, our fourth example, with four padding values specified, will assign the values in a clockwise direction: "padding-top," "padding-right," "padding-bottom," and "padding-left" respectively.

    Next, we will work with borders. Let’s take a look at the "border" shorthand property.

    More Style Sheets Articles
    More By Alejandro Gervasio


       ·  Here's a tight reference about the most common CSS shorthand properties,...
       · I always thought this stuff was common sense...Guess I took it for granted... I...
       ·  I agree with you about writing clean CSS code. That's the right way to...
     

    STYLE SHEETS ARTICLES

    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification
    - CSS: Dimensions
    - CSS: Margins and Padding
    - CSS: Crossing the Border
    - CSS: Text, Fonts, and Tables
    - CSS: Working with Text
    - CSS: Backgrounds
    - CSS for the Newbie







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway