Skip to content

Commit f14bc8f

Browse files
committed
Merge pull request #10 from bblurock/translate-html-page
[Update] HTML and CSS 翻譯
2 parents bf10705 + 9fa82d0 commit f14bc8f

File tree

2 files changed

+155
-147
lines changed

2 files changed

+155
-147
lines changed

manual/zh-TW/coding-standards/chapters/css.md

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,93 @@
11
## CSS
2-
These guidelines have been assembled following an examination of emerging practices, ideas and existing styleguides, namely:
2+
這份準則是透過檢視一些新興的程式實作、想法、以及現有的編碼規範所集思廣益而成,並引用以下清單中所使用的概念:
33

44
1. [OOCSS Code Standards](https://github.com/stubbornella/oocss-code-standards)
55
2. [Oneweb Style Guide](https://github.com/nternetinspired/OneWeb/blob/master/STYLEGUIDE.md)
66
3. [Idiomatic CSS](https://github.com/necolas/idiomatic-css)
77

88

9-
## Commenting
9+
## 註解
10+
11+
### 主要段落
12+
主要的程式碼段落必須以完整的註解區塊作為開頭,例如:
1013

11-
### Major sections
12-
Major code sections should be named in caps and within a full comment block, eg:
1314
```css
1415
/* ==========================================================================
1516
PRIMARY NAVIGATION
1617
========================================================================== */
1718
```
1819

19-
### Sub sections
20-
Subsections should be normally cased and within an open comment block.
20+
### 次要段落
21+
次要段落須以開放式的註解區塊為開頭:
22+
2123
```css
2224
/* Mobile navigation
2325
========================================================================== */
2426
```
2527

26-
### Verbose comments
28+
### 文字註解
2729
```css
2830
/**
29-
* Short description using Doxygen-style comment format
31+
* 短的註解描述使用 Doxygen 風格的註解格式
3032
*
3133
* The first sentence of the long description starts here and continues on this
3234
* line for a while finally concluding here at the end of this paragraph.
3335
*
34-
* The long description is ideal for more detailed explanations and
35-
* documentation. It can include example HTML, URLs, or any other information
36-
* that is deemed necessary or useful.
36+
* 長的註解描述很適合做詳細的解釋與說明。如果有需要,可以使用 HTML、URLs 或其他資訊作為範例。
3737
*
3838
* @tag This is a tag named 'tag'
3939
*
40-
* TODO: This is a todo statement that describes an atomic task to be completed
41-
* at a later date. It wraps after 80 characters and following lines are
42-
* indented by 2 spaces.
40+
* TODO: 這是一個註解區塊中 todo 的範例,描述之後需要被完成的項目。
41+
* 一行應小於 80 個字元,換行之後須以兩個空白作為縮排開頭
4342
*/
4443
```
4544

46-
### Basic comments
45+
### 基本註解方式
4746
```css
4847
/* Basic comment */
4948
```
5049

51-
### Uncompiled LESS/Scss comments
50+
### 未編譯的 LESS/Scss 註解
5251
```css
53-
// These are stripped on compile.
52+
// 這段註解在編譯的時候會被移除
5453
```
5554

56-
## Class naming
57-
Use dashes to create compound class names:
55+
## Class 命名方式
56+
使用破折號 (-) 來處理復合式命名:
5857

5958
```css
60-
/* Good - use dashes */
59+
/* 正確 - 使用破折號 */
6160
.compound-class-name {…}
6261

63-
/* Bad - uses underscores */
62+
/* 錯誤 - 使用底線 */
6463
.compound_class_name {…}
6564

66-
/* Bad - uses camelCase */
65+
/* 錯誤 - 使用駝峰式命名 */
6766
.compoundClassName {…}
6867

69-
/* Bad - does not use seperators */
68+
/* 錯誤 - 不使用符號分隔 */
7069
.compoundclassname {…}
7170
```
7271

73-
### Indentation
74-
Rules should be indented one tab (equal to 4 spaces):
72+
### 縮排
73+
須以一個 tab 來縮排 (等於 4 個空白)
7574

7675
```css
77-
/* Good */
76+
/* 正確 */
7877
.example {
7978
color: #000;
8079
visibility: hidden;
8180
}
8281

83-
/* Bad - all on one line */
82+
/* 錯誤 - 寫在同一行 */
8483
.example {color: #000; visibility: hidden;}
8584
```
8685

86+
LESS/Scss 也應該正確被縮排寫成巢狀,其子選擇器還有樣式規則都應該縮排。巢狀的規則須以一空行作為間隔:
8787
LESS/Scss should also be nested , with child selectors and rules indented again. Nested rules should also be spaced by one line:
8888

8989
```css
90-
/* Good */
90+
/* 正確 */
9191
.example {
9292

9393
> li {
@@ -101,7 +101,7 @@ LESS/Scss should also be nested , with child selectors and rules indented again.
101101
}
102102

103103
}
104-
/* Bad - nested rules not indented */
104+
/* 錯誤 - 巢狀的樣式沒有正確縮排 */
105105
.example {
106106

107107
> li {
@@ -115,7 +115,7 @@ LESS/Scss should also be nested , with child selectors and rules indented again.
115115
}
116116

117117
}
118-
/* Bad - nested rules not spaced */
118+
/* 錯誤 - 巢狀的規則沒有以一空行作為間隔 */
119119
.example {
120120
> li {
121121
float: none;
@@ -127,93 +127,94 @@ LESS/Scss should also be nested , with child selectors and rules indented again.
127127
}
128128
```
129129

130-
### Alignment
131-
The opening brace must be on the same line as the last selector and preceded by a space. The closing brace must be on its own line after the last property and be indented to the same level as the opening brace.
130+
### 對齊
131+
左大括號必須跟選擇器位於同一行,並前綴一空白字元。右大括號須存在於最後一個屬性規則之後並獨立於新的一行,且應與左大括號處於相同的縮排。
132132

133133
```css
134-
/* Good */
134+
/* 正確 */
135135
.example {
136136
color: #fff;
137137
}
138138

139-
/* Bad - closing brace is in the wrong place */
139+
/* 錯誤 - 右大括號的位置錯了,沒有正確縮排 */
140140
.example {
141141
color: #fff;
142142
}
143143

144-
/* Bad - opening brace missing space */
144+
/* 錯誤 - 左大括號之前沒有空白 */
145145
.example{
146146
color: #fff;
147147
}
148148
```
149149

150-
### Property Format
151-
Each property must be on its own line and indented one level. There should be no space before the colon and one space after. All properties must end with a semicolon.
150+
### 樣式屬性格式
151+
每一個屬性都應該存在獨立的一行,並縮排一個層級。冒號之前不應該有空白字元,但須後綴一空白字元。所有的樣式屬性須以分號 (;) 作為結尾。
152152

153153
```css
154-
/* Good */
154+
/* 正確 */
155155
.example {
156156
background: black;
157157
color: #fff;
158158
}
159159

160-
/* Bad - missing spaces after colons */
160+
/* 錯誤 - 冒號後面沒有後綴空白 */
161161
.example {
162162
background:black;
163163
color:#fff;
164164
}
165165

166-
/* Bad - missing last semicolon */
166+
/* 錯誤 - 沒有以分號作為結尾 */
167167
.example {
168168
background: black;
169169
color: #fff
170170
}
171171
```
172172

173-
### HEX values
174-
HEX values must be declared in lowercase and shorthand:
173+
### HEX 值
174+
HEX 值應該使用小寫並以最小縮寫宣告:
175+
175176
```css
176-
/* Good */
177+
/* 正確 */
177178
.example {
178179
color: #eee;
179180
}
180181

181-
/* Bad */
182+
/* 錯誤 */
182183
.example {
183184
color: #EEEEEE;
184185
}
185186
```
186187

187-
### Attribute selectors
188-
Always use double quotes around attribute selectors.
188+
### HTML 屬性選擇器
189+
屬性選擇器須以雙引號包含。
189190

190191
```css
191-
/* Good */
192+
/* 正確 */
192193
input[type="button"] {
193194
...
194195
}
195196

196-
/* Bad - missing quotes */
197+
/* 錯誤 - 沒有雙引號 */
197198
input[type=button] {
198199
...
199200
}
200201

201-
/* Bad - using single quote */
202+
/* 錯誤 - 使用單引號 */
202203
input[type='button'] {
203204
...
204205
}
205206
```
206207

207-
### Zero value units
208-
Zero values should not carry units.
208+
### 零值的單位
209+
零值不應該使用單位。
209210

210211
```css
211-
/* Good */
212+
/* 正確 */
212213
.example {
213214
padding: 0;
214215
}
215216

216-
/* Bad - uses units */
217+
/* 錯誤 - 使用單位 */
217218
.example {
218219
padding: 0px;
219220
}

0 commit comments

Comments
 (0)