Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 8db0f4d

Browse files
author
Irfan Maulana
committed
id-version
1 parent 67c8242 commit 8db0f4d

File tree

1 file changed

+64
-62
lines changed

1 file changed

+64
-62
lines changed

README.md

+64-62
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Airbnb CSS / Sass Styleguide
22

3-
*A mostly reasonable approach to CSS and Sass*
3+
*Sebagian pendekatan yang paling umum untuk CSS dan Sass*
44

5-
## Table of Contents
5+
## Daftar Isi
66

7-
1. [Terminology](#terminology)
7+
1. [Terminologi](#terminologi)
88
- [Rule Declaration](#rule-declaration)
99
- [Selectors](#selectors)
1010
- [Properties](#properties)
@@ -24,11 +24,11 @@
2424
- [Nested selectors](#nested-selectors)
2525
1. [Translation](#translation)
2626

27-
## Terminology
27+
## Terminologi
2828

2929
### Rule declaration
3030

31-
A “rule declaration” is the name given to a selector (or a group of selectors) with an accompanying group of properties. Here's an example:
31+
“Rule declaration” adalah nama yang diberikan pada suatu <em>selector</em> (atau group dari beberapa <em>selector</em>) dengan properti-properti di yang berada dalamnya. Berikut misalnyanya:
3232

3333
```css
3434
.listing {
@@ -39,7 +39,7 @@ A “rule declaration” is the name given to a selector (or a group of selector
3939

4040
### Selectors
4141

42-
In a rule declaration, “selectors” are the bits that determine which elements in the DOM tree will be styled by the defined properties. Selectors can match HTML elements, as well as an element's class, ID, or any of its attributes. Here are some examples of selectors:
42+
Di deklarasi rule, “<em>selector</em>” dijelaskan sebagai sebuah aturan yang menjelaskan bagaimana sebuah element di dalam sebuah <em>DOM Tree</em> akan di beri <em>style</em> berdasarkan properti yang dijabarkan di dalamnya. <em>Selector</em> bisa menggunakan HTML Element, class dari HTML element, ID, atau attribute apapun yang terdapat di HTML element tersebut. Berikut beberapa misalnya selectors:
4343

4444
```css
4545
.my-element-class {
@@ -53,7 +53,7 @@ In a rule declaration, “selectors” are the bits that determine which element
5353

5454
### Properties
5555

56-
Finally, properties are what give the selected elements of a rule declaration their style. Properties are key-value pairs, and a rule declaration can contain one or more property declarations. Property declarations look like this:
56+
Akhirnya, Properti (en :“<em>property</em>”) adalah <em>style</em> apapun yang akan diterapkan pada element terpilih. Properti adalah sebuah pasangan key dan value dengan deklarasi rule yang bisa memuat satu atau lebih deklarasi dari sebuah properti. Deklarasi properti akan terlihat seperti berikut:
5757

5858
```css
5959
/* some selector */ {
@@ -66,17 +66,17 @@ Finally, properties are what give the selected elements of a rule declaration th
6666

6767
### Formatting
6868

69-
* Use soft tabs (2 spaces) for indentation
70-
* Prefer dashes over camelCasing in class names.
71-
- Underscores and PascalCasing are okay if you are using BEM (see [OOCSS and BEM](#oocss-and-bem) below).
72-
* Do not use ID selectors
73-
* When using multiple selectors in a rule declaration, give each selector its own line.
74-
* Put a space before the opening brace `{` in rule declarations
75-
* In properties, put a space after, but not before, the `:` character.
76-
* Put closing braces `}` of rule declarations on a new line
77-
* Put blank lines between rule declarations
69+
* Gunakan “<em>soft tabs</em>” (2 spasi) untuk indentasi
70+
* Lebih baik <em>dashes</em> dibandingkan <em>camelCase</em> di dalam nama class.
71+
- Garis bawah (_) dan <em>PascalCasing</em> tidak mengapa apabila Anda menggunakan BEM (lihat pembahasan [OOCSS and BEM](#oocss-and-bem) dibawah).
72+
* Jangan gunakan ID selectors
73+
* Ketika menggunakan “<em>multiple selectors</em>” di deklarasi rule, tambahkan baris baru ke masing-masing selector tersebut.
74+
* Tambahkan spasi sebelum kurung kurawal (<em>brace</em>) pembuka `{` di deklarasi rule.
75+
* Di properti, tambahkan spasi setelahnya, tapi tidak sebelumnya dari karakter `:`.
76+
* Tambahkan baris baru pada kurung kurawal (<em>brace</em>) penutup `}` dari deklarasi rule.
77+
* Tambahkan baris kosong antara deskripsi rule.
7878

79-
**Bad**
79+
**Jangan**
8080

8181
```css
8282
.avatar{
@@ -90,7 +90,7 @@ Finally, properties are what give the selected elements of a rule declaration th
9090
}
9191
```
9292

93-
**Good**
93+
**Sebaiknya**
9494

9595
```css
9696
.avatar {
@@ -107,34 +107,34 @@ Finally, properties are what give the selected elements of a rule declaration th
107107

108108
### Comments
109109

110-
* Prefer line comments (`//` in Sass-land) to block comments.
111-
* Prefer comments on their own line. Avoid end-of-line comments.
112-
* Write detailed comments for code that isn't self-documenting:
113-
- Uses of z-index
114-
- Compatibility or browser-specific hacks
110+
* Lebih baik menggunakan <em>comment</em> sebaris (`//` di dalam Sass) dibandingkan blok comment.
111+
* Lebih baik comment di barisnya sendiri. Hindari comments pada baris paling terakhir.
112+
* Tulis dengan detail comment dari sebuah code yang tidak mempunyai dokumentasi sendiri, misal:
113+
- Penggunaan z-index
114+
- Kompatibilitas atau hack dari sebuah browser-specific
115115

116116
### OOCSS and BEM
117117

118-
We encourage some combination of OOCSS and BEM for these reasons:
118+
Kami mendorong beberapa kombinasi dari OOCSS dan BEM untuk beberapa alasan berikut:
119119

120-
* It helps create clear, strict relationships between CSS and HTML
121-
* It helps us create reusable, composable components
122-
* It allows for less nesting and lower specificity
123-
* It helps in building scalable stylesheets
120+
* Membantu menulis code dengan lebih jelas, memperjelas hubungan antara CSS dan HTML
121+
* Membantu kita membuat code reusable, <em>composable components</em>
122+
* Membuat nesting lebih sedikit dan lebih spesifik
123+
* Membantu dalam membangun stylesheets yang scalable
124124

125-
**OOCSS**, or “Object Oriented CSS”, is an approach for writing CSS that encourages you to think about your stylesheets as a collection of “objects”: reusable, repeatable snippets that can be used independently throughout a website.
125+
**OOCSS**, atau “Object Oriented CSS”, adalah sebuah pendekatan dalam menulis CSS yang mendorong Anda untuk berpikir mengenai <em>stylesheets</em> sebagai sebuah kumpulan “objects”: <em>reusable</em>, potongan code yang bisa digunakan berulang secara independent didalam sebuah website.
126126

127127
* Nicole Sullivan's [OOCSS wiki](https://github.com/stubbornella/oocss/wiki)
128128
* Smashing Magazine's [Introduction to OOCSS](http://www.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/)
129129

130-
**BEM**, or “Block-Element-Modifier”, is a _naming convention_ for classes in HTML and CSS. It was originally developed by Yandex with large codebases and scalability in mind, and can serve as a solid set of guidelines for implementing OOCSS.
130+
**BEM**, atau “Block-Element-Modifier”, adalah sebuah _naming convention_ untuk “classes” di HTML dan CSS. Pertama kali dibangun oleh Yandex dengan codebase yang besar dan scalability, dan bisa digunakan sebagai kumpulan panduan dalam meng-implementasi OOCSS.
131131

132132
* CSS Trick's [BEM 101](https://css-tricks.com/bem-101/)
133133
* Harry Roberts' [introduction to BEM](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/)
134134

135-
We recommend a variant of BEM with PascalCased “blocks”, which works particularly well when combined with components (e.g. React). Underscores and dashes are still used for modifiers and children.
135+
Kami merekomendasikan variasi dari BEM dengan PascalCased “blocks”, yang bekerja sangat baik bila dikombinasikan dengan components (seperti React). Garis bawah (_ en: underline) dan strip (- en: dashes) tetap digunakan sebagai pembatas untuk modifiers dan anak dibawahnya.
136136

137-
**Example**
137+
**Contoh**
138138

139139
```jsx
140140
// ListingCard.jsx
@@ -161,39 +161,39 @@ function ListingCard() {
161161
.ListingCard__content { }
162162
```
163163

164-
* `.ListingCard` is the “block” and represents the higher-level component
165-
* `.ListingCard__title` is an “element” and represents a descendant of `.ListingCard` that helps compose the block as a whole.
166-
* `.ListingCard--featured` is a “modifier” and represents a different state or variation on the `.ListingCard` block.
164+
* `.ListingCard` adalah “block” dan me-representasikan sebuah component dengan level tertinggi
165+
* `.ListingCard__title` adalah “element” dan me-representasikan sebuah anak dari `.ListingCard` yang membantu membentuk blok secara keseluruhan.
166+
* `.ListingCard--featured` adalah “modifier” dan me-representasikan sebuah perubahan state atau variasi di `.ListingCard` block.
167167

168168
### ID selectors
169169

170-
While it is possible to select elements by ID in CSS, it should generally be considered an anti-pattern. ID selectors introduce an unnecessarily high level of [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) to your rule declarations, and they are not reusable.
170+
Meskipun memungkinkan untuk memilih element berdasarkan ID dalam CSS, hal tersebut umumnya harus dianggap sebagai anti-pola. ID selector memperkenalkan tingkat yang tidak terlalu tinggi [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) terhadap deklarasi rule Anda, dan itu tidak reusable.
171171

172-
For more on this subject, read [CSS Wizardry's article](http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/) on dealing with specificity.
172+
Untuk hal ini, baca lebih lanjut [CSS Wizardry's article](http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/).
173173

174174
### JavaScript hooks
175175

176-
Avoid binding to the same class in both your CSS and JavaScript. Conflating the two often leads to, at a minimum, time wasted during refactoring when a developer must cross-reference each class they are changing, and at its worst, developers being afraid to make changes for fear of breaking functionality.
176+
Hindari <em>binding</em> class yang sama di kedua CSS dan JavaScript. <em>Conflating</em> antara keduanya sering menyebabkan paling tidak waktu yang terbuang selama refactoring ketika developer harus <em>cross-reference</em> masing-masing class yang berubah, dan yang paling buruk, developer menjadi takut untuk melakukan perubahan karena takut merusak fungsi.
177177

178-
We recommend creating JavaScript-specific classes to bind to, prefixed with `.js-`:
178+
Kami merekomendasikan membuat JavaScript-specific class untuk melakukan binding, dengan prefix `.js-`:
179179

180180
```html
181181
<button class="btn btn-primary js-request-to-book">Request to Book</button>
182182
```
183183

184184
### Border
185185

186-
Use `0` instead of `none` to specify that a style has no border.
186+
Gunakan `0` dibandingkan `none` untuk menjelaskan bahwa style tersebut tidak mempunyai border.
187187

188-
**Bad**
188+
**Jangan**
189189

190190
```css
191191
.foo {
192192
border: none;
193193
}
194194
```
195195

196-
**Good**
196+
**Sebaiknya**
197197

198198
```css
199199
.foo {
@@ -205,14 +205,14 @@ Use `0` instead of `none` to specify that a style has no border.
205205

206206
### Syntax
207207

208-
* Use the `.scss` syntax, never the original `.sass` syntax
209-
* Order your regular CSS and `@include` declarations logically (see below)
208+
* Gunakan `.scss` syntax, Jangan pernah gunakan `.sass` syntax asli.
209+
* Urutkan CSS biasa dan `@include` logika deklarasi Anda (lihat dibawah)
210210

211-
### Ordering of property declarations
211+
### Mengurutkan deklarasi properti
212212

213-
1. Property declarations
213+
1. Deklarasi properti
214214

215-
List all standard property declarations, anything that isn't an `@include` or a nested selector.
215+
Daftar semua deklarasi property standard, sesuatu yang bukan sebuah `@include` atau nested selector.
216216

217217
```scss
218218
.btn-green {
@@ -222,9 +222,9 @@ Use `0` instead of `none` to specify that a style has no border.
222222
}
223223
```
224224

225-
2. `@include` declarations
225+
2. Deklarasi `@include`
226226

227-
Grouping `@include`s at the end makes it easier to read the entire selector.
227+
Menggabungkan `@include`s di akhir membuatnya lebih mudah untuk membaca keseluruhan selector.
228228

229229
```scss
230230
.btn-green {
@@ -237,7 +237,7 @@ Use `0` instead of `none` to specify that a style has no border.
237237

238238
3. Nested selectors
239239

240-
Nested selectors, _if necessary_, go last, and nothing goes after them. Add whitespace between your rule declarations and nested selectors, as well as between adjacent nested selectors. Apply the same guidelines as above to your nested selectors.
240+
Nested selectors, _if necessary_, buat di paling akhir, dan jangan buat apapun setelahnya. Tambahkan spasi antara deklarasi rule Anda dan nested selectors, serta antara nested selectors yang berdekatan. Terapkan pedoman yang sama seperti di atas untuk nested selectors Anda.
241241

242242
```scss
243243
.btn {
@@ -253,19 +253,19 @@ Use `0` instead of `none` to specify that a style has no border.
253253

254254
### Variables
255255

256-
Prefer dash-cased variable names (e.g. `$my-variable`) over camelCased or snake_cased variable names. It is acceptable to prefix variable names that are intended to be used only within the same file with an underscore (e.g. `$_my-variable`).
256+
Lebih baik menggunakan dash-cased untuk nama variabel (misalnya `$my-variable`) dibandingkan camelCased atau snake_cased. Hal ini dapat diterima sebagai awalan nama variabel yang dimaksudkan untuk digunakan hanya dalam file yang sama dengan garis bawah (en: underscore) (misalnya `$_my-variable`).
257257

258258
### Mixins
259259

260-
Mixins should be used to DRY up your code, add clarity, or abstract complexity--in much the same way as well-named functions. Mixins that accept no arguments can be useful for this, but note that if you are not compressing your payload (e.g. gzip), this may contribute to unnecessary code duplication in the resulting styles.
260+
Mixin harus digunakan untuk DRY-UP code Anda, menambah kejelasan, atau mengurangi kompleksitas abstrak terlalu dalam sebagaimana juga dengan memberi nama yang baik terhadap function. Mixin yang menerima tanpa argumen dapat berguna untuk ini, tetapi perhatikan bahwa jika Anda tidak mengompresi payload Anda (misalnya gzip), ini dapat berkontribusi terhadap duplikasi code yang tidak perlu dalam style yang dihasilkan.
261261

262262
### Extend directive
263263

264-
`@extend` should be avoided because it has unintuitive and potentially dangerous behavior, especially when used with nested selectors. Even extending top-level placeholder selectors can cause problems if the order of selectors ends up changing later (e.g. if they are in other files and the order the files are loaded shifts). Gzipping should handle most of the savings you would have gained by using `@extend`, and you can DRY up your stylesheets nicely with mixins.
264+
`@extend` harus dihindari karena memiliki perilaku unintuitive dan berpotensi berbahaya, terutama bila digunakan dengan nested selectors. Bahkan memperluas selector placeholder pada tingkat atas yang dapat menyebabkan masalah jika urutan selector berubah nantinya (misalnya jika mereka berada di file lain dan urutan load file-file tersebut digeser). Gzip harus menangani sebagian besar penghematan yang akan Anda dapatkan dengan menggunakan `@ extend`, dan Anda tetap dapat men DRY-UP stylesheet Anda baik menggunakan mixin.
265265

266266
### Nested selectors
267267

268-
**Do not nest selectors more than three levels deep!**
268+
**Jangan gunakan nested selector lebih dari tiga level!**
269269

270270
```scss
271271
.page-container {
@@ -277,20 +277,21 @@ Mixins should be used to DRY up your code, add clarity, or abstract complexity--
277277
}
278278
```
279279

280-
When selectors become this long, you're likely writing CSS that is:
280+
Ketika selectors menjadi sebegitu panjang, Anda telah menulis CSS seperti ini:
281281

282-
* Strongly coupled to the HTML (fragile) *—OR—*
283-
* Overly specific (powerful) *—OR—*
284-
* Not reusable
282+
* Terlalu berpatokan terhadap HTML (rapuh) *—OR—*
283+
* Terlalu spesifik (powerful) *—OR—*
284+
* Tidak reusable
285285

286286

287-
Again: **never nest ID selectors!**
287+
Sekali lagi: **Jangan pernah nesting ID selectors!**
288288

289-
If you must use an ID selector in the first place (and you should really try not to), they should never be nested. If you find yourself doing this, you need to revisit your markup, or figure out why such strong specificity is needed. If you are writing well formed HTML and CSS, you should **never** need to do this.
290289

291-
## Translation
290+
Jika Anda harus menggunakan ID selector di tempat pertama (dan Anda harus benar-benar mencoba untuk tidak melakukannya), mereka tidak boleh nested. Jika Anda menemukan diri Anda melakukan hal ini, Anda perlu untuk meninjau kembali markup Anda, atau mencari tahu mengapa hal tersebut diperlukan. Jika Anda menulis dengan baik HTML dan CSS, Anda seharusnya ** tidak pernah** harus melakukan hal ini.
292291

293-
This style guide is also available in other languages:
292+
## Translation
293+
294+
Panduan style ini juga tersedia dalam bahasa lain:
294295

295296
- ![tw](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Taiwan.png) **Chinese (Traditional)**: [ArvinH/css-style-guide](https://github.com/ArvinH/css-style-guide)
296297
- ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [Zhangjd/css-style-guide](https://github.com/Zhangjd/css-style-guide)
@@ -300,3 +301,4 @@ If you must use an ID selector in the first place (and you should really try not
300301
- ![ru](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Russia.png) **Russian**: [Nekorsis/css-style-guide](https://github.com/Nekorsis/css-style-guide)
301302
- ![es](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Spain.png) **Spanish**: [ismamz/guia-de-estilo-css](https://github.com/ismamz/guia-de-estilo-css)
302303
- ![vn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Vietnam.png) **Vietnamese**: [trungk18/css-style-guide](https://github.com/trungk18/css-style-guide)
304+
- ![id](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Indonesia.png) **Bahasa Indonesia**: [mazipan/css-style-guide](https://github.com/mazipan/css-style-guide)

0 commit comments

Comments
 (0)