Showing posts with label code pen. Show all posts
Showing posts with label code pen. Show all posts

Thursday, October 19, 2023

Responsive CSS Cards -Free Code + Demo


                Responsive CSS Cards -Free Code + Demo

                

        All code 100% Free code and open source  

        How to create Responsive Cards Using HTML and CSS Here is the Example With Live Demo + Source Code 

        

Output Sample Image

 




                CSS Card with Hover Effects Code Pen





<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Responsive Card Design HTML and CSS</title>
    <!-- Font Awesome Icons -->
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
    />
    <!-- Custom CSS -->
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="card-list">
      <a href="#" class="card-item">
        <img
          src="https://t-hub.mx/storage/blog/QopQLVRlmihNPF4aWnSPKuCvV2ja4HuXTCsaM7Cw.jpeg"
          alt="Card Image"
        />
        <span class="developer">Developer</span>
        <h3>
          Lorem ipsum dolor sit amet consectetur, adipisicing elit.
          Voluptatibus, deleniti..
        </h3>
        <div class="arrow">
          <i class="fas fa-arrow-right card-icon"></i>
        </div>
      </a>
      <a href="#" class="card-item">
        <img
          src="https://simplefreethemes.com/wp-content/uploads/2018/09/Graphic-Designing.jpg"
          alt="Card Image"
        />
        <span class="designer">Designer</span>
        <h3>
          Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi
          accusantium odit in harum dolore
        </h3>
        <div class="arrow">
          <i class="fas fa-arrow-right card-icon"></i>
        </div>
      </a>
      <a href="#" class="card-item">
        <img
          src="https://techguide.io/wp-content/uploads/2018/05/video-editing.jpg"
          alt="Card Image"
        />
        <span class="editor">Editor</span>
        <h3>
          Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nisi,
          repellat
        </h3>
        <div class="arrow">
          <i class="fas fa-arrow-right card-icon"></i>
        </div>
      </a>
    </div>
  </body>
</html>

                    

     This simple example creates a responsive card that adjusts its size and layout based on the screen width. The card contains an image, a title, a description, and a "Read More" link. The CSS code defines the styles and uses media queries to make the card width adapt to smaller screens. You can customize this card with your content and additional styles as needed.                           


The provided code is an HTML document that creates a simple webpage with a responsive card design using HTML and CSS. Let's break down the key components of this HTML code:

Explanation 

<!DOCTYPE html>: This declaration defines the document type and version of HTML being used, which is HTML5 in this case.

<html lang="en">: This opening tag represents the beginning of the HTML document, and it specifies that the document is in the English language ("en").

<head>: The head section contains meta information about the document and links to external resources. In this section, you have:

<meta charset="UTF-8">: Specifies the character encoding for the document as UTF-8.

<meta name="viewport" content="width=device-width, initial-scale=1.0">: Sets the viewport configuration for responsive design.


<title>Responsive Card Design HTML and CSS</title>: Defines the title of the webpage, which appears in the browser's title bar or tab.


Links to external resources:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">: Loads the Font Awesome Icons library for using icons.

<link rel="stylesheet" href="style.css">: Links to an external CSS file named "style.css" for additional styling.

<body>: This section contains the content of the webpage that will be displayed to users. It includes a <div> element with a class "card-list" and several <a> elements with the class "card-item." These elements are used to create individual cards in a card list.

Each card (defined by the <a> elements) contains the following elements:

An <img> element with a source URL, representing an image for the card.

A <span> element with a class (e.g., "developer," "designer," "editor") to indicate the type of card.

An <h3> element with a description or text content for the card.

A <div> element with a class "arrow" that contains an icon represented by an <i> element with a Font Awesome class "fas fa-arrow-right card-icon."

Each card is created with similar structure but different content and images.

The intention of this code is to create a webpage with a list of responsive cards, each with an image, a label (e.g., "Developer," "Designer"), a description, and an arrow icon. The styling for these cards is expected to be provided in the linked "style.css" file.

Please note that the style.css file mentioned in the HTML code is likely where the styling and layout for these cards would be defined. If you need more information or have specific questions about the CSS or any other part of this code, feel free to ask.


Second, create a CSS file with the name of style.css and paste the given codes in your CSS file. Remember, you’ve to create a file with .css extension.


Now , add the following CSS code to your style.css file to style

/* Importing Google font - Open Sans */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
}

body {
  background: #223;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  max-width: 1250px;
  margin: 150px auto;
  padding: 20px;
  gap: 20px;
}

.card-list .card-item {
  padding: 26px;
  background: linear-gradient(to right top, #ff01e1, #01ffd0);
  border-radius: 8px;
  box-shadow: 0px 3px 5px 3px rgb(21, 21, 41);
  list-style: none;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  border: 2px solid transparent;
  transition: border 0.5s ease;
}
.card-list .card-item:hover {
  border: 2px solid #000;
}
.card-list .card-item img {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  object-fit: cover;
  transition: all 0.3s;
  filter: blur(2.5px);
}
.card-list span {
  display: inline-block;
  margin-top: 32px;
  margin-left: 0px;
  width: 100%;
  padding: 10px 15px;
  font-size: 0.75rem;
  border-radius: 5px;
  text-align: center;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.2em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 2px #000;
}

.card-item h3 {
  color: #ceced1;
  font-size: 1rem;
  text-align: center;
  margin-top: 28px;
  font-weight: 600;
}

.card-item .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  color: #ceced1;
  border: 1px solid #000;
  border-radius: 50%;
  float: right;
  margin-top: 40px;
  transition: 0.2s ease;
}

.card-list .card-item:hover .arrow {
  background: #223;
  color: #fff;
}
.card-item img:hover {
  transform: scale(1.05);
  filter: blur(0);
}
@media (max-width: 1200px) {
  .card-list .card-item {
    padding: 15px;
  }
}

@media screen and (max-width: 980px) {
  .card-list {
    margin: 0 auto;
  }
}


Tags : 

responsive css cards codepen,
responsive cards css grid,
css responsive card hover effects,
css responsive card design,
css responsive card layout,
tailwind css responsive cards,

Sunday, October 15, 2023

How To Create Calculator Project Using HTML CSS and JavaScript


How to make Calculator Using HTML CSS and JavaScript 

Simple Calculator Project Using HTML CSS and JavaScript 

                Firstly We can create a structure of calculator  with the help of HTML 
and Design and Now design our structure by using CSS or Add JavaScript Events for perform the task 
successfully 

Calculator Project img

OUTPUT OF CALCULATOR






Introduction


Briefly introduce the concept of creating a calculator using web technologies.
Explain that the tutorial will guide readers through the process step by step.
Highlight the importance of HTML, CSS, and JavaScript in web development.
Prerequisites

Mention what readers should already know (e.g., basic HTML, CSS, and JavaScript knowledge).
Provide links to relevant resources if readers need to brush up on these topics.

Step 1: Setting Up the HTML Structure


Create the HTML file and set up the basic structure.
Include the necessary HTML elements like <div>, <input>, and <button> for the calculator.

Step 2: Adding CSS Styles


Explain the importance of CSS in designing the calculator.
Create a separate CSS file and link it to the HTML.
Apply styles to the calculator elements for a visually appealing layout.

Step 3: Implementing the JavaScript Logic


Describe the role of JavaScript in making the calculator functional.
Create a JavaScript file and link it to the HTML document.
Begin by defining variables and functions.

Step 4: Handling User Input


Explain how to capture user input by clicking on buttons.
Use event listeners to detect button clicks.
Display the user's input on the calculator screen.

Step 5: Performing Calculations


Demonstrate how to implement basic arithmetic operations (addition, subtraction, multiplication, division) in JavaScript.
Provide code examples for each operation.
Update the screen with the results of calculations.

Step 6: Adding Clear and Equal Buttons


Include buttons to clear the screen and calculate results.
Explain how to handle these actions with JavaScript.
Step 7: Styling for Interactivity

Enhance the user experience by adding CSS styles for button hover and click effects.
Make the calculator visually responsive to user actions.

Step 8: Testing and Troubleshooting


Discuss the importance of testing the calculator's functionality.
Provide tips for debugging and solving common issues.

Conclusion


Summarize the key points of the tutorial.
Encourage readers to experiment with the calculator and make improvements.
Emphasize the importance of practice in web development.
Next Steps

Suggest additional features or functionalities that readers can add to their calculator.
Provide links to advanced tutorials or resources for further learning.
Final Thoughts

Express your excitement for readers who have successfully created their own calculator.
Encourage them to continue exploring web development and JavaScript.
Additional Tips:

Include code snippets with proper formatting and syntax highlighting.
Use clear and concise explanations.
Add images or diagrams to illustrate concepts.
Make the blog post SEO-friendly by including relevant keywords and meta tags.
This blog post will help your readers learn how to create a basic calculator using HTML, CSS, and JavaScript, providing them with valuable web development skills.

1 ) open Your Code Editor and Create New File index.html  and paste the html code  


              It is important to create any project in html firstly you Need to
             create HTML file With index.html you can customize the code Example 
            text color , background color , font Size , and you can add more function             if You want .


            copy code the whole HTML code and simply paste it  


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, height=device-height, initial-scale=1 user-scalable=no, shrink-to-fit=no"
    />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Simple Calculator</title>
    <link rel="stylesheet" href="./styles/style.css" />
  </head>
  <body>
    <div class="toggle-container">
      <label class="toggle-switch">
        <input type="checkbox" id="toggle-mode" />
        <span class="toggle-slider"></span>
      </label>
    </div>
    <div class="container">
      <h1>
        <a
          style="
            text-decoration: none;
            color: #f1c40f;
            margin-left: 1.25rem;
            cursor: pointer;
          "
          onclick="location.reload();"
          >CALCULATOR</a
        >
      </h1>
      <div class="calculator">
        <input type="text" name="screen" id="answer" readonly />
        <table>
          <tr>
            <td><button>(</button></td>
            <td><button>)</button></td>
            <td>
              <div class="row">
                <div class="col">
                  <button
                    style="
                      background-color: #f01600;
                      font-weight: bold;
                      color: #ecf0f1;
                      width: 8vw;
                    "
                    onclick="clearAll()"
                  >
                    C
                  </button>
                </div>
                <div class="col">
                  <button
                    style="
                      background-color: #f01600;
                      font-weight: bold;
                      color: #ecf0f1;
                      width: 8vw;
                    "
                    onclick="deleteLastEntry()"
                  >
                    CE
                  </button>
                </div>
              </div>
            </td>
            <td><button>%</button></td>
          </tr>
          <tr>
            <td><button>7</button></td>
            <td><button>8</button></td>
            <td><button>9</button></td>
            <td><button>X</button></td>
          </tr>
          <tr>
            <td><button>4</button></td>
            <td><button>5</button></td>
            <td><button>6</button></td>
            <td><button>-</button></td>
          </tr>
          <tr>
            <td><button>1</button></td>
            <td><button>2</button></td>
            <td><button>3</button></td>
            <td><button>+</button></td>
          </tr>
          <tr>
            <td><button>0</button></td>
            <td><button style="font-weight: bold">.</button></td>
            <td><button>/</button></td>
            <td>
              <button
                style="
                  background-color: #25db72;
                  font-weight: bold;
                  color: #ecf0f1;
                "
              >
                =
              </button>
            </td>
          </tr>
        </table>
        <hr style="max-width: 50vw" />
        <div
          style="
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
          "
        >
         
        </div>
      </div>
    </div>
    <div id="bar1" class="bars"></div>
    <div id="bar2" class="bars"></div>
    <div id="history"></div>
    <div id="turn">PLEASE TURN YOUR DEVICE</div>
  </body>

 
 
  </script>
</html>


2) Now Create another file name style.css 

in this file you can custmize your calculator 

 paste CSS Code Before adding CSS code Link Your CSS File With your HTML Page Kindly check Your HTML Page It is a Important for some times we forgot to link stylesheet page so  

 
body,
html {
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    color: #ecf0f1;
    background-color: rgb(23, 24, 37);
    font-family: 'Fjalla One', sans-serif;
    animation: fadein 1.5s;
    font-family: 'Fjalla One', sans-serif;
}
 @keyframes fadein {
    0% {
        opacity: 0%;
    }
    100%   {
        opacity: 100%;
    }
  }

h1 {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 0;
}

input {
    background-color: rgba(52, 73, 94, 0.5);
    color: #ecf0f1;
    outline: none;
    text-align: right;
    border: none;
    font-size: 3rem;
    width: 80vw;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.5rem 1.5rem;
    -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
    -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
    box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
}

.container {
    margin: auto;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.calculator {
    padding: 0.25rem;
    display: inline-block;
}

table {
    margin: auto;
}

button {
    border: none;
    background-color: white;
    width: 20vw;
    height: 10vh;
    padding: 0.5rem 0;
    margin: 0.25vmax;
    font-size: 2vmax;
    border-radius: 1rem;
    -moz-transition: all ease 0.5s;
    -webkit-transition: all 0.5s ease;
    transition: all 0.5s ease;
    -o-transition: all ease 0.5s;
}
button:active {
    transform: scale(0.95);
    /* Scaling button to 0.98 to its original size */
    box-shadow: 3px 2px 22px 1px rgba(0, 0, 0, 0.24);
    /* Lowering the shadow */
}

button:hover {
    -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
    -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
    box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
    -moz-transition: all ease 0.5s;
    -webkit-transition: all 0.5s ease;
    transition: all 0.5s ease;
    -o-transition: all ease 0.5s;
}

a{
    outline: none;
    -moz-transition: all ease 0.5s;
    -webkit-transition: all 0.5s ease;
    transition: all 0.5s ease;
    -o-transition: all ease 0.5s;
}

a:hover{
    text-shadow: 0px 0px 10px rgba(241, 196, 15, 0.5);
    -moz-transition: all ease 0.5s;
    -webkit-transition: all 0.5s ease;
    transition: all 0.5s ease;
    -o-transition: all ease 0.5s;
}

#turn {
    display: none;
    z-index: 100;
    position: fixed;
}

#historybutton{
    width:40px;
    height:40px;
    border-radius: 20px;
    float:right;
    margin-right:15px;
    cursor: pointer;
}

#history{
    position: absolute;
    width:90%;
    height: 80vh;
    top:10vh;
    background-color: white;
    border: 6px solid black;
    border-radius: 10px;
    display: none;
    /* overflow-y: scroll; */
}

.historyelement{
    color: black;
    margin: 20px;
    font-size: 40px;
}

#bar1, #bar2{
    position: absolute;
    width:30px;
    height: 4px;
    background-color: white;
    margin-top: 20px;
    margin-right: 20px;
    margin-left: 93%;
    transform: rotate(45deg);
    cursor: pointer;
    display: none;
}

#bar2{
    transform: rotate(135deg);
}

@media (orientation: landscape) and (max-height: 500px) {
    #turn {
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 2rem;
        color: rgba(52, 73, 94, 1.0);
        background-color: rgba(236, 240, 241, 1.0);
    }
}

.toggle-container {
    position: absolute;
    top: 4rem;
    left: 3rem;
   
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: rgb(233, 227, 227);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
    border-radius: 10px;
}

input:checked + .toggle-slider {
    background-color: #2a2c2e;
    border-radius: 10px;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #2b2c2d;
    border-radius: 10px;
}


input:checked + .toggle-slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Dark mode styles */

.dark-mode {
    background-color: black;
    border-radius: 10px;
    color: #fff;
}

.dark-mode body,
.dark-mode html {
     background-color: black;
     border-radius: 10px;
     
}

.dark-mode .calculator {
     background-color: black;
     border-radius: 10px;
   
}

.dark-mode table {
    color: #fff;
    border-radius: 10px;
}

.dark-mode button {
    background-color: #555;
    color: #fff;
    border-radius: 10px;
}


 .dark-mode a {
    color: #fff;
    border-radius: 10px;
}

.row{
    display: flex;
    font-size: 1rem;
    justify-content: center;
    max-width: 20vw;
    margin: auto;
}
 
#answer {
    caret-color: #0f38f1;
}
/* Negative Numbers */
.negative {
    color: red;
  }

2) Here Now Create Your JavaScript Page With name script.js name , Now link Your JavaScript File With HTML File Inside Body tag add your JavaScript file on Load your browser  Successfully. 



    window.dataLayer = window.dataLayer || [];
    function gtag() {
      dataLayer.push(arguments);
    }
    gtag("js", new Date());
    gtag("config", "UA-70447982-5");
  </script>
  <script>
    const toggleMode = document.getElementById("toggle-mode");
    const container = document.querySelector(".container");

    toggleMode.addEventListener("change", function () {
      container.classList.toggle("dark-mode");
    });

    document.addEventListener("keydown", function (event) {
      handleKeyPress(event.key);
    });

    // This function will be responsible for handling the button press from the keyboard..Try thses key also if want you can also chnage these settings,...
    function handleKeyPress(key) {
      //  "Enter" key is pressed, trigger the "=" button press
      if (key === "Enter") {
        handleButtonPress("=");
      }
      // "Delete" or "Backspace" key is pressed, trigger the "CE" button press
      if (key === "Delete" || key === "Backspace") {
        handleButtonPress("CE");
      }
      //number key is pressed, trigger the corresponding number button press
      if (/[0-9]/.test(key)) {
        handleButtonPress(key);
      }
      //  operator key is pressed (+, -, *, /), trigger the corresponding operator button press
      if (/[\+\-\*\/%]/.test(key)) {
        handleButtonPress(key);
      }
    }
    function handleButtonPress(value) {
      // This function simulates the button press of the calculator for the given value
      // Find the corresponding button element based on the value
      const button = document.querySelector(`button[value="${value}"]`);
      if (button) {
        button.click();
      }
    }






            tags : web development projects with source code , web development projects , CSS Animations , JavaScript Projects With source code.



        Related Post :

10 Mind-Blowing CSS Animation Examples (Free Code + Demos).

JavaScript Programming Syntax Tips.

Create a Stunning 3D Carousel with HTML, CSS, and JavaScript.




Latest Updates

Responsive Design with HTML and CSS SPYDEVCODE