Results 1 to 4 of 4

Thread: clarification - space or no space

  1. #1
    Join Date
    Jan 2007
    Posts
    51
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Default clarification - space or no space

    Ok, so I'm not a css expert by far, but can get what I need done.

    I took a CSS intro class about 2 years ago and the guy said to not leave spaces between the operand(I think that's the right term) and the parameter, it can cause errors....

    ex: text-align:left;

    However, nearly everywhere I go in reading examples, everyone uses spaces.

    ex: text-align: left;

    I know this is probably more academic than anything else, but I just thought I'd check and see since there are a number of experts floating around on this forum.

    Yeah, I'm one of those nit-picky programmers...

    Thanks!
    BN

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    I don't think it matters one bit. It's just personal preference. I usually add a space after the colon as it's more readable that way.

    What your instructor might have been referring to are inline paramaters. For example:

    Code:
    <table cellspacing="0" cellpadding="0">
    In the above case, adding spaces after the "operand" (equals sign) would be inappropriate but might will render probably.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I concur that it doesn't matter at all whether you use spaces between properties/values or not. It's generally easier to read if you do.

    One place where it can matter, though, is between the selector and the opening { of a property block. A space there isn't technically necessary, but omitting it can cause bugs in earlier versions of IE, so leaving it out is bad style.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jan 2007
    Posts
    51
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by Twey View Post
    One place where it can matter, though, is between the selector and the opening { of a property block. A space there isn't technically necessary, but omitting it can cause bugs in earlier versions of IE, so leaving it out is bad style.
    Ah, I bet that's what he was talking about... thanks.

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
  •