Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navigation Menu Unik dengan Dark Mode</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
    <nav class="menu">
        <ul>
            <li><a href="#home">Home</a></li>
            <li><a href="#articles">Articles</a></li>
            <li><a href="#photography">Photography</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
        </ul>
        <button class="dark-mode-toggle">Dark Mode</button>
    </nav>
    <script src="script.js"></script>
</body>
</html>
<h1>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kolom Teks dengan Radius dan Bayangan</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="container">
        <div class="text-column">
            <h2>Welcome to My Website</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sit amet magna vitae justo faucibus luctus. Proin fermentum malesuada velit, in congue sem malesuada at.</p>
        </div>
    </div>
</body>
</html>

              
            
!

CSS

              
                body {
    font-family: Arial, candara;
    background-color: #3f4234;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.menu {
    font-size: 0;
    position: relative; /* Menambahkan posisi relatif untuk bayangan */
}

.menu ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    position: relative; /* Menambahkan posisi relatif untuk bayangan */
}

.menu ul li {
    margin: 0 10px;
    position: relative;
}

.menu ul li a {
    font-size: 16px;
    text-decoration: none;
    color: #333;
    padding: 10px 15px;
    display: inline-block;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative; /* Menambahkan posisi relatif untuk bayangan */
}

.menu ul li a:hover {
    color: #555;
    transform: translateY(-3px);
}

.menu ul li a:before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    width: 10px;
    height: 10px;
    background-color: #333;
    transform: translateX(-50%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu ul li a:hover:before {
    opacity: 1;
}

.menu ul li:nth-child(1) a:before {
    background-color: #ff5e3a;
}

.menu ul li:nth-child(2) a:before {
    background-color: #3f4234;
}

.menu ul li:nth-child(3) a:before {
    background-color: #00a8cc;
}

.menu ul li:nth-child(4) a:before {
    background-color: #007849;
}

.menu ul li:nth-child(5) a:before {
    background-color: #8e44ad;
}

.dark-mode-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 10; /* Mengatur z-index agar tombol dark mode muncul di atas menu */
}

.dark-mode-toggle:hover {
    background-color: #555;
}

.dark-mode {
    background-color: #222;
    color: #ddd;
}

.dark-mode .menu ul li a {
    color: #ddd;
}

.dark-mode .menu ul li a:before {
    background-color: #fff;
}
body {
    font-family: Arial, Candara;
    background-color: #f2f2f2;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
}

.text-column {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    padding: 20px;
}

.text-column h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.text-column p {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
}


              
            
!

JS

              
                const darkModeToggle = document.querySelector('.dark-mode-toggle');
const body = document.body;

darkModeToggle.addEventListener('click', () => {
    body.classList.toggle('dark-mode');
});

              
            
!
999px

Console