SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,657
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    What are some lesser known css shorthand tricks?

    I enjoy trimming my css to the bare bones. One way is via shorthand.

    background:...; instead of "background-color"
    border:0; instead of "none"
    font-weight:100; instead of "normal"
    background:#fff url(img_tree.png) 0 0 no-repeat; instead of "color, image, position, repeat"
    color:#fff; instead of "#ffffff"
    0; instead of "0px"
    animation:blink normal 2s infinite ease-in-out; instead of "name, direction, duration, iteration-count, timing-function"
    font:16px/1.6 bold italic Arial; instead of "size, line-height, weight, style, family"

    Some off the top of my head. Do you have any more to contribute?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,377
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    background:#fff url(img_tree.png) 0 0 no-repeat;

    You can omit the 0 0 as that is the default.

  3. #3
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,657
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Paul O'B View Post
    You can omit the 0 0 as that is the default.
    I new somebody was going to call me on that lol. yes and same with position absolute and fixed in most cases.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •