mrfdn.com – Mode gelap, atau mode gelap, telah menjadi tren desain antarmuka pengguna yang populer.
Banyak pengguna mengapresiasi opsi ini karena mengurangi kelelahan mata dan meningkatkan kenyamanan saat menggunakan perangkat di malam hari.
Pada artikel kali ini kita akan membahas cara menerapkan mode gelap pada halaman HTML menggunakan HTML, CSS, dan JavaScript.

Versi 1: tanpa sakelar#
Pada contoh pertama ini, kami menggunakan 2 tombol untuk mengklik secara manual antara mode terang atau mode gelap.
<!DOCTYPE html>
<html lang="en" theme="dark">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet">
<style>
#darkmode {
background: #222;
color: #eee;
}
</style>
</head>
<body>
<h1>halo raf</h1>
<p>raf</p>
<button onclick="setDarkMode(true)">dark</button>
<button onclick="setDarkMode(false)">light</button>
</body>
<script>
if(localStorage.getItem('theme') == 'dark')
setDarkMode(true)
function setDarkMode(isDark){
if(isDark) {
document.body.setAttribute('id', 'darkmode')
localStorage.setItem('theme', 'dark')
} else {
document.body.setAttribute('id', '')
localStorage.removeItem('theme')
}
}
</script>
</html>
Versi 2: dengan sakelar#
Pada skrip HTML berikut ini, kami hanya menggunakan 1 tombol yang berfungsi sebagai tombol alih untuk mengubah mode gelap ke mode terang dan sebaliknya.
<!DOCTYPE html>
<html lang="en" theme="dark">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet">
<style>
.dark-mode {
background: #222;
color: #eee;
}
</style>
</head>
<body>
<h1>Dark Mode</h1>
<p>jagotekno.com</p>
<button id="toggleButton">Toggle Dark Mode</button>
</body>
<script>
const toggleButton = document.getElementById('toggleButton');
const body = document.body;
toggleButton.addEventListener('click', () => {
body.classList.toggle('dark-mode');
});
</script>
</html>
kesimpulan#
Menerapkan mode gelap ke halaman HTML tidaklah sulit.
Dengan menggunakan kombinasi HTML, CSS, dan JavaScript, Anda dapat memberikan opsi yang nyaman bagi pengguna Anda.
Pastikan untuk mengintegrasikan elemen mode gelap ini dengan keseluruhan desain situs web Anda agar sesuai dengan tema yang Anda inginkan.
Pastikan untuk menguji tampilan halaman Anda di berbagai perangkat dan browser untuk memastikan konsistensi.
Semoga beruntung!
PakarPBN
A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.
In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.
The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.