<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Erifeta Purity</title>
    <description>The latest articles on DEV Community by Erifeta Purity (@purity170).</description>
    <link>https://dev.to/purity170</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1405647%2F982d4cf3-51b5-4f02-9c0e-de919d9db964.png</url>
      <title>DEV Community: Erifeta Purity</title>
      <link>https://dev.to/purity170</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/purity170"/>
    <language>en</language>
    <item>
      <title>How to Apply External CSS Stylesheets to HTML Documents</title>
      <dc:creator>Erifeta Purity</dc:creator>
      <pubDate>Wed, 03 Apr 2024 22:23:00 +0000</pubDate>
      <link>https://dev.to/purity170/how-to-apply-external-css-stylesheets-to-html-documents-10lo</link>
      <guid>https://dev.to/purity170/how-to-apply-external-css-stylesheets-to-html-documents-10lo</guid>
      <description>&lt;p&gt;Cascading Style Sheets (CSS) are fundamental for designing visually appealing and structured web pages. When it comes to styling HTML documents, CSS plays a crucial role in defining the layout, colors, fonts, and other visual aspects. One common practice in web development is to use external CSS stylesheets to separate the presentation from the content, making it easier to manage and maintain the codebase. In this article, we'll explore how to apply external CSS stylesheets to HTML documents.&lt;/p&gt;

&lt;h4&gt;
  
  
  Understanding External CSS Stylesheets:
&lt;/h4&gt;

&lt;p&gt;External CSS stylesheets are files containing CSS code that can be linked to HTML documents. By linking an external stylesheet to an HTML file, you can apply the same styles across multiple web pages, ensuring consistency and easier maintenance. This approach also allows for better organization of code and promotes the principle of separation of concerns.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating an External CSS File:
&lt;/h4&gt;

&lt;p&gt;Before applying external stylesheets to HTML documents, you need to create a CSS file. Follow these steps to create an external CSS file:&lt;/p&gt;

&lt;h5&gt;
  
  
  Create a New File:
&lt;/h5&gt;

&lt;p&gt;Open a text editor or an Integrated Development Environment (IDE) of your choice.&lt;/p&gt;

&lt;h5&gt;
  
  
  Write CSS Code:
&lt;/h5&gt;

&lt;p&gt;Start writing CSS code to define the styles you want to apply to your HTML elements. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* styles.css */

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

h1 {
    color: #333;
}

.container {
    width: 80%;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Save the File:
&lt;/h5&gt;

&lt;p&gt;Save the file with a &lt;code&gt;.css&lt;/code&gt; extension, such as &lt;code&gt;styles.css&lt;/code&gt;, in a directory accessible to your HTML documents.&lt;/p&gt;

&lt;h4&gt;
  
  
  Linking CSS to HTML Documents:
&lt;/h4&gt;

&lt;p&gt;Once you've created the external CSS file, you can link it to your HTML documents using the &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; element. Follow these steps to link the CSS file to your HTML document:&lt;/p&gt;

&lt;h5&gt;
  
  
  Open the HTML File:
&lt;/h5&gt;

&lt;p&gt;Open the HTML file that you want to style in your text editor or IDE.&lt;/p&gt;

&lt;h5&gt;
  
  
  Insert the &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; Element:
&lt;/h5&gt;

&lt;p&gt;Within the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section of your HTML document, insert the following &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; element:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;!-- Your HTML content goes here --&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;href&lt;/code&gt; attribute specifies the path to your external CSS file relative to the HTML document.&lt;/p&gt;

&lt;h5&gt;
  
  
  Save the HTML File:
&lt;/h5&gt;

&lt;p&gt;Save the changes to your HTML file.&lt;/p&gt;

&lt;h4&gt;
  
  
  Applying Styles:
&lt;/h4&gt;

&lt;p&gt;With the external CSS file linked to your HTML document, you can now start applying styles to your HTML elements. Simply use the selectors defined in your CSS file to target specific elements and apply the desired styles. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="container"&amp;gt;
        &amp;lt;h1&amp;gt;Welcome to My Website&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;This is a paragraph of text.&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the styles defined in the &lt;code&gt;styles.css&lt;/code&gt; file will be applied to the &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; elements within the &lt;code&gt;.container&lt;/code&gt; div.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion:
&lt;/h4&gt;

&lt;p&gt;Using external CSS stylesheets is a best practice in web development for separating presentation from content, improving code organization, and promoting code reusability. By following the steps outlined in this article, you can effectively apply external CSS stylesheets to your HTML documents, making your web pages visually appealing and well-structured.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a Responsive Countdown Timer for Events</title>
      <dc:creator>Erifeta Purity</dc:creator>
      <pubDate>Wed, 03 Apr 2024 14:34:15 +0000</pubDate>
      <link>https://dev.to/purity170/creating-a-responsive-countdown-timer-for-events-2k84</link>
      <guid>https://dev.to/purity170/creating-a-responsive-countdown-timer-for-events-2k84</guid>
      <description>&lt;p&gt;Countdown timers are invaluable tools for event organizers seeking to generate anticipation and urgency among attendees. Whether it's for a product launch, a webinar, or a special occasion, a well-designed countdown timer can effectively build excitement and encourage participation. In this comprehensive guide, we'll walk you through the process of creating a responsive countdown timer using HTML, CSS, and JavaScript.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. HTML Structure:
&lt;/h4&gt;

&lt;p&gt;First, let's lay down the foundation by creating the HTML structure for our countdown timer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;title&amp;gt;Event Countdown Timer&amp;lt;/title&amp;gt;
  &amp;lt;link rel="stylesheet" href="styles.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="countdown"&amp;gt;
    &amp;lt;div class="timer"&amp;gt;
      &amp;lt;span id="days"&amp;gt;00&amp;lt;/span&amp;gt;
      &amp;lt;span id="hours"&amp;gt;00&amp;lt;/span&amp;gt;
      &amp;lt;span id="minutes"&amp;gt;00&amp;lt;/span&amp;gt;
      &amp;lt;span id="seconds"&amp;gt;00&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. CSS Styling (styles.css):
&lt;/h4&gt;

&lt;p&gt;Now, let's add some style to our countdown timer to make it visually appealing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
}

.countdown {
  text-align: center;
}

.timer span {
  font-size: 3rem;
  margin: 0 10px;
  padding: 10px;
  background: #333;
  color: #fff;
  border-radius: 5px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. JavaScript (script.js):
&lt;/h4&gt;

&lt;p&gt;The final piece of the puzzle is the JavaScript code that will make our countdown timer functional.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function countdown() {
  const eventDate = new Date("2024-12-31T00:00:00").getTime(); // Change to your event date
  const now = new Date().getTime();
  const distance = eventDate - now;

  const days = Math.floor(distance / (1000 * 60 * 60 * 24));
  const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  const seconds = Math.floor((distance % (1000 * 60)) / 1000);

  document.getElementById("days").innerHTML = formatTime(days);
  document.getElementById("hours").innerHTML = formatTime(hours);
  document.getElementById("minutes").innerHTML = formatTime(minutes);
  document.getElementById("seconds").innerHTML = formatTime(seconds);
}

function formatTime(time) {
  return time &amp;lt; 10 ? `0${time}` : time;
}

// Initial call
countdown();

// Update the countdown every second
setInterval(countdown, 1000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Explanation:
&lt;/h4&gt;

&lt;h4&gt;
  
  
  HTML Structure:
&lt;/h4&gt;

&lt;p&gt;We've defined a simple HTML structure consisting of a container div with a class of "countdown" and individual spans for days, hours, minutes, and seconds.&lt;/p&gt;

&lt;h4&gt;
  
  
  CSS Styling:
&lt;/h4&gt;

&lt;p&gt;The CSS file (styles.css) provides basic styling to the countdown timer, including font size, padding, background color, and border radius.&lt;/p&gt;

&lt;h4&gt;
  
  
  JavaScript:
&lt;/h4&gt;

&lt;p&gt;The JavaScript code calculates the time remaining until the event date, updates the countdown timer every second, and formats the time to ensure it always displays two digits.&lt;/p&gt;

&lt;p&gt;By following these steps, you can easily create a responsive countdown timer for your events. Simply customize the event date in the JavaScript code to match the specific date and time of your event, and you're all set to generate excitement and anticipation among your audience!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
