white-space

In CSS, sub attributes within a master attribute have a “-” as a word separator. For instance, it is background-color and background-image which can be shorted into background.

Today I was trying to recall the white-space attribute for CSS. Why the hell is this white-space and not whitespace? It makes me think there is a shortcut attribute white.

Instead of putting   everywhere in your HTML, you use whitespace: nowrap;. This gets me thinking why the hell it isn’t no-wrap? After all it is no-repeat.

Man, this shit is as bad as PHP.

3 thoughts on “white-space

  1. Probably because every attribute in CSS that is two words is deliminated by a hyphen, while properties not necessarily.

    I am thinking of specifically:
    min-height
    max-height
    min-width
    letter-spacing
    white-space
    line-height
    list-style
    empty-cells
    vertical-align
    voice-family
    word-spacing

    and on and on.

    In fact, there isnt one single CSS attribute that is 2 words, and concatenated without a hyphen.

    However, most properties are hyphenated, so I dont know why they skipped nowrap, but considering that it’s pretty rare, I’d hardly compare it to PHP’s naming problems 🙂

  2. @Nate: Excellent point that clears a lot of confusion! I guess I was thinking that there were attribute parts like darkshadow and autospace that are missing dashes so I guessed the naming convention incorrectly.

    The answer to PHP’s naming problems is http://php.net/enter best guess here. Of course, sometimes I think that’s the cause of them. 😀

  3. Are you sure it’s not php.net/enterbestguesshere or php.net/enter_best_guess_here or guess_here($var, ENTER_BEST)?

    Wow, and the PHP nerdiness continues! 😉

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.