开发者

CSS Brace Styles

I'm unable to figure how the standard (or just popular) brace style names apply to CSS. Here're all the brace styles:

/* one - pico? */
selector { property: value; 
           property: value; }

/* two - pico extra */
selector { 
    property: val开发者_C百科ue; /* Start Properties on Newline */
    property: value; }

/* three - horstmann? */
selector 
{ property: value;
  property: value;
}

/* four - GNU? */
selector 
{ 
    property: value; /* Start Properties on Newline */
    property: value;
}​

/* five - GNU Saver */
selector { property: value;
           property: value;
}

/* six - CSS Default */
selector { 
    property: value; /* Start Properties on Newline */
    property: value;
}

/* seven - Braces Aligned */
selector { property: value;
           property: value;
         }

/* eight - Banner? */
selector {
    property: value; /* Start Properties on Newline */
    property: value;
    }

Can someone please name each brace style for me?

Many thanks!


I would say three is Horstmann.

Pico as it is, but the opening brace starts on a newline.

Banner would be:

selector {
    property: value;
    property: value;
    }

The rest of your guesses seem correct.

I took most of these from Indent style on Wikipedia :)


I think you named the most popular indent styles yourself. I personally, prefer:

.class {
  property: value;
}


four should be Allman Style

it's my favorite


I sometimes write css with the starting- and ending brace on the same line.
Often used like:
.foo {width:100%;height:550px;}

How would this be named?

/* Nine - Almost-optimized(?) */
selector { property: value; property: value; }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜