DeveloperBreeze

Html Programming Tutorials, Guides & Best Practices

Explore 5+ expertly crafted html tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Creating a Countdown Timer with JavaScript

Tutorial October 24, 2024
php

Now, let's create the JavaScript code to calculate and display the remaining time.

We need a function that takes the end time (the deadline) as input and calculates the difference between the current time and the deadline:

Exporting Table Row Data to CSV in JavaScript

Tutorial October 24, 2024
php

  • querySelectorAll('.export-btn'): Selects all elements with the class export-btn, i.e., the export buttons.
  • closest('tr'): This retrieves the closest table row (<tr>) that contains the clicked button.
  • querySelectorAll('td'): Retrieves all the <td> cells in the row.
  • Array.from(): Converts the list of cells into an array, which allows us to manipulate it easily.
  • cells.pop(): Removes the last cell (the one containing the export button), as we don’t want it in the CSV.
  • textContent: Extracts the text content from each cell.
  • encodeURIComponent(): Encodes the CSV string, making it safe for use in a URL.
  • anchor.download: Specifies the filename for the CSV file (in this case, row_data.csv).
  • anchor.click(): Programmatically triggers a click on the anchor element, which starts the download.

Here’s a complete example of the HTML and JavaScript code together:

دليل شامل لتطوير الويب: بناء موقع بسيط باستخدام HTML, CSS وJavaScript

Tutorial September 27, 2024
javascript css html

HTML هي لغة ترميز تساعدك في إنشاء الهيكل الأساسي لصفحة الويب. إليك الهيكل الأساسي لموقع ويب بسيط:

<!DOCTYPE html>
<html lang="ar">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>موقعي الشخصي</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <header>
        <h1>مرحباً بكم في موقعي</h1>
        <nav>
            <ul>
                <li><a href="#home">الرئيسية</a></li>
                <li><a href="#about">من أنا</a></li>
                <li><a href="#contact">تواصل معي</a></li>
            </ul>
        </nav>
    </header>

    <section id="home">
        <h2>مقدمة</h2>
        <p>هذا هو موقعي الشخصي حيث أشارك فيه أفكاري ومشاريعي.</p>
    </section>

    <section id="about">
        <h2>من أنا</h2>
        <p>أنا مطور ويب مهتم بتقنيات الويب الحديثة وتطوير التطبيقات.</p>
    </section>

    <section id="contact">
        <h2>تواصل معي</h2>
        <form id="contact-form">
            <label for="name">الاسم:</label>
            <input type="text" id="name" name="name" required>

            <label for="email">البريد الإلكتروني:</label>
            <input type="email" id="email" name="email" required>

            <label for="message">رسالتك:</label>
            <textarea id="message" name="message" required></textarea>

            <button type="submit">إرسال</button>
        </form>
    </section>

    <footer>
        <p>© 2024 جميع الحقوق محفوظة</p>
    </footer>

    <script src="scripts.js"></script>
</body>
</html>

HTML5 Cheatsheet

Cheatsheet August 03, 2024
html

  <audio controls>
      <source src="audio.mp3" type="audio/mpeg">
      Your browser does not support the audio element.
  </audio>
  • Inline Elements: Do not start on a new line and only take up as much width as necessary. Examples include <span>, <a>, <em>, <strong>.
  • Block Elements: Start on a new line and take up the full width available. Examples include <div>, <p>, <h1>, <ul>, <table>.