Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Membuat dokumentasi HTML Figure #263

Merged
merged 8 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions HTML/046 HTML Figure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# HTML Figure

## Apa itu HTML Figure?

HTML Figure merupakan semantic HTML5 yang digunakan untuk menandai atau menjelaskan sebuah konten. Element `<figure>` juga dapat memberitahukan kepada browser bahwa dia adalah sebuah wadah yang menampung beberapa element yang memiliki hubungan satu sama lain.

Konten yang ada di dalam `<figure>` biasanya terdiri dari gambar dan `<figcaption>` sebagai keterangan.

```html
<figure>
<img src="kucing-oren.jpg" alt="kucing oren" />
<figcaption>Kucing oren</figcaption>
</figure>
```

Maka hasilnya seperti ini:

![HTML Figure](contoh-gambar.png)

## Contoh kode

Selain gambar, element `<figure>` juga dapat menyimpan video, barisan kode, kutipan dan lain-lain.

Contoh barisan kode:

```html
<figure>
<pre>
<code>
p {
color: green;
}
</code>
</pre>
<figcaption>contoh memberikan warna teks dengan CSS</figcaption>
</figure>
```

Contoh kutipan:

```html
<figure>
<figcaption><b>Ali bin Abi Thalib berkata:</b></figcaption>
<blockquote>
Janganlah engkau mengucapkan perkataan yang engkau sendiri tak suka
mendengarnya jika orang lain mengucapkannya kepadamu.
</blockquote>
</figure>
```
Binary file added HTML/046 HTML Figure/contoh-gambar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions HTML/046 HTML Figure/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
figure {
width: 400px;
border: 2px solid burlywood;
border-radius: 4px;
}
figure img {
width: 100%;
}

figcaption {
padding-left: 4px;
}
</style>
</head>
<body>
<!-- contoh figure yang berisi gambar -->
<figure>
<img src="kucing-oren.jpg" alt="kucing oren" />
<figcaption>Kucing oren</figcaption>
</figure>
</body>
</html>
Binary file added HTML/046 HTML Figure/kucing-oren.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.