Como crear mi primera pagina web, html css y javascript

 

como crear una pagina web con html css javascript sencillo con los siguentes pasos.

creamos y archivo llamda index.html, styles.css y script,js, el contenido del archivo index.html 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <!-- displays site properly based on user's device -->

  <link rel="icon" type="image/png" sizes="32x32" 
  href="./images/favicon-32x32.png">

  <link rel="stylesheet" href="styles.css">

  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;
    500&display=swap" rel="stylesheet">
  
  <title>Frontend Mentor | Dashboard </title>
</head>
<body>
  <main>
    <div id="container">
      <div class="card card-1">
        <div id="profile">
          <img src="./images/image-jeremy.png" alt="Jeremy Robson Picture">
          <div id="report"> 
            <p>Reporte por</p>
            <h1>Jeremy Robson</h1>
          </div>
        </div>
        <div id="options">
          <p id="daily">Dia</p>
          <p id="weekly">Semanal</p>
          <p id="monthly">Mensual</p>
        </div> 
      </div>

      <div class="card card-2">
        <div class="card-content">
          <div class="card-header">
            <h2>Trabajo</h2>
            <p>...</p>
          </div>
          <div class="values">
            <p class="current-value" id="work-value">5hrs</p>
            <p class="previous-value" id="previous-work-value">Anterio - 7hrs</p>
          </div>
        </div>
      </div>

      <div class="card card-3">
        <div class="card-content">
          <div class="card-header">
            <h2>Play</h2>
            <p>...</p>
          </div>
          <div class="values">
            <p class="current-value" id="play-value">1hr</p>
            <p class="previous-value" id="previous-play-value">Anterior - 2hrs</p>
          </div>
        </div>
      </div>

      <div class="card card-4">
        <div class="card-content">
          <div class="card-header">
            <h2>Estudio</h2>
            <p>...</p>
          </div>
          <div class="values">
            <p class="current-value" id="study-value">0hrs</p>
            <p class="previous-value" id="previous-study-value">Anterior - 1hr</p>
          </div>
        </div>
      </div>

      <div class="card card-5">
        <div class="card-content">
          <div class="card-header">
            <h2>Ejercicio</h2>
            <p>...</p>
          </div>
          <div class="values">
            <p class="current-value" id="exercise-value">1hr</p>
            <p class="previous-value" id="previous-exercise-value">Anterior - 1hr</p>
          </div>
        </div>
      </div>

      <div class="card card-6">
        <div class="card-content">
          <div class="card-header">
            <h2>Social</h2>
            <p>...</p>
          </div>
          <div class="values">
            <p class="current-value"  id="social-value">1hr</p>
            <p class="previous-value" id="previous-social-value">Anterior - 3hrs</p>
          </div>
        </div>
      </div>

      <div class="card card-7">
        <div class="card-content">
          <div class="card-header">
            <h2>Salud</h2>
            <p>...</p>
          </div> 
          <div class="values">
            <p class="current-value" id="selfcare-value">0hrs</p>
            <p class="previous-value" id="previous-selfcare-value">Anterior - 1hr</p>
          </div>
        </div>
      </div>
    </div>
  </main>

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

el contenido del archivo styles.css

* {
    margin0;
    padding0;
    box-sizingborder-box;
    font-family'Rubik'sans-serif;
    colorvar(--desatured-blue);
}
.attribution { font-size11pxtext-aligncenter; }
.attribution a { colorhsl(22845%44%); }

:root {
    --bluehsl(24680%60%);
    --workhsl(15100%70%);
    --playhsl(19574%62%);
    --studyhsl(348100%68%);
    --exercisehsl(14558%55%);
    --socialhsl(26464%52%);
    --self-carehsl(4384%65%);
    --very-dark-bluehsl(22643%10%);
    --dark-bluehsl(23546%20%);
    --desatured-bluehsl(23545%61%);
    --pale-bluehsl(236100%87%);
}

html {
    width100vw;
    height100vh;
    background-colorvar(--very-dark-blue);
}

main {
    min-width100%;
    min-height100%;
    displayflex;
    justify-contentcenter;
    align-itemscenter;
}

#container {
    height100%;
    displaygrid;
    grid-template-columnsrepeat(41fr);
    grid-template-rows.3fr 1fr 1fr;
    gap20px;
    grid-template-areas:
    "x x x x"
    "c1 c2 c3 c4"
    "c1 c5 c6 c7"
    ;
}

.card {
    width250px;
    min-height250px;
    background-colorhsl(23546%20%);
    border-radius10px;
    border-bottom-left-radius15px;
    border-bottom-right-radius15px;
    displayflex;
}

.card-1 {
    displayflex;
    flex-directioncolumn;
    grid-area: c1;
}

#profile {
    displayflex;
    flex-directioncolumn;
    background-colorvar(--blue);
    border-radius10px;
    padding-left10%;
    height70%;
    
}

#profile img{
    align-selfbaseline;
    border-radius50%;
    border4px solid #fff;
    width90px;
    height90px;
    margin15% 0 20%;
}

#report p {
    colorvar(--pale-blue);
}

#report h1 {
   font-weight300;
   colorvar(--pale-blue);
   font-size40px;
}

#options {
    displayflex;
    flex-directioncolumn;
    margin10% 10%;
    colorvar(--desatured-blue);  
}

#options p {
    margin-bottom15px;
    cursorpointer;
    font-size18px;
}

#options p:hover {
    colorvar(--pale-blue);
    transition0.5s;
}

.card-2 {
    backgroundurl(images/icon-work.svgno-repeat;
    background-positionright 8% top;
    background-colorvar(--work);;
    grid-area: c2;
}
.card-3 {
    backgroundurl(images/icon-play.svgno-repeat;
    background-positionright 8% top;
    background-colorvar(--play);
    grid-area: c3;
}
.card-4 {
    backgroundurl(images/icon-study.svgno-repeat;
    background-positionright 8% top;
    background-colorvar(--study);
    grid-area: c4;
}
.card-5 {
    backgroundurl(images/icon-exercise.svgno-repeat;
    background-positionright 8% top;
    background-colorvar(--exercise);
    grid-area: c5;
}
.card-6 {
    backgroundurl(images/icon-social.svgno-repeat;
    background-positionright 8% top;
    background-colorvar(--social);
    grid-area: c6;
}
.card-7 {
    backgroundurl(images/icon-self-care.svgno-repeat;
    background-positionright 8% top;
    background-colorvar(--self-care);
    grid-area: c7;
}

.card-content:hover {
    background-colorhsl(23546%25%);
    transition0.6s;
}

.card-content {
    width100%;
    margin-top20%;
    border-top-left-radius20px;
    border-top-right-radius20px;
    border-radius10px;
    background-color:hsl(23546%20%);
}

.card-header {
    displayflex;
    justify-contentspace-around;
    
}

.card-header h2 {
    colorvar(--pale-blue);
    font-weight400;
    font-size18px;
    margin-top10%;
    padding-right30%;
}

.card-header p {
    margin-top3.5%;
    font-size30px;
    cursorpointer;
}

.card-header p:hover {
    colorvar(--pale-blue);
    transition0.5s;
}

.current-value {
    colorvar(--pale-blue);
    font-size48px;
    margin-left10%;
    margin-top10%;
    font-weight300;
}

.previous-value {
    margin-left10%;
    margin-top3%;
}

.active {
    color#ededed;
}

@media (max-width300px){
    #options p {
        font-size16px;
        font-weight400;
    }
    .card-content {
        min-height120px;
    }
}

@media (width540px) {
    .current-value {
        padding-left25px;
    }
}

@media (max-width600px) {
    #container {
        displayflex;
        flex-directioncolumn;
    }
    .card {
        width80vw;
        min-height150px;
        margin-bottom20px;
    }

    #profile {
        displayflex;
        flex-directionrow;
        align-itemscenter;
        height100px;
    }
    #profile img {
        width60px;
        height60px;
        margin-top20px;
    }
    #report {
        margin-left5%;
    }

    #report h1 {
        font-weight300;
        colorvar(--pale-blue);
        font-size18px;
     }
    #options {
        displayflex;
        flex-directionrow;
        justify-contentspace-around;
        height20px;
    }

    .card.card-1 {
        min-height50px;
    }

    .card-content {
        margin-top15%;
        height110px;
    }

    .card.card-2,.card.card-3,.card.card-4,.card.card-5,.card.card-6,.card.card-7 {
        height120px;
    }
    .current-value  {
        font-size28px;
        margin0 0 0 32px;
    }

    .previous-value {
        font-size14px;
        margin-right34px;
    }

    .values {
        displayflex;
        flex-directionrow;
        justify-contentspace-between;
    }
}

@media (min-width601px) and (max-width900px ) {
    #report h1 {
        font-size18px;
        margin-bottom20px;
    }
    .card {
        width160px;
        min-height160px;
    }
    .card-header p {
        margin-top1.4%;
    }
    #daily {
        margin-top10px;
    }
    .current-value {
        font-size26px;
    }
    .card-2 .card-header h2 {
        margin-left6px;
    }
    .card-3 .card-header h2 {
        margin-left3px;
    }
    .card-4 .card-header h2 {
        margin-left6px;
        padding0 48px 0 0;
    }
    .card-5 .card-header h2 {
        margin-left4px;
        padding0 29px 0 0;
    }
    .card-6 .card-header h2 {
        margin-left3px;
        padding0 42px 0 0;
    }
    .card-7 .card-header h2 {
        margin-left8px;
        padding0 20px 0 0;
    }
}

@media(min-width901px) and (max-width1279px) {
    .card {
        width220px;
        min-height220px;
    }
}

el contenido del archivo script.js

const DAILY = document.querySelector("#daily");
const WEEKLY = document.querySelector("#weekly");
const MONTHLY = document.querySelector("#monthly");


const data = fetch("./data.json")
.then(r => r.json())
.then(d => {
    const changeOption = value => {
        let period = '';
        if(value === 'daily'){
            DAILY.classList.add("active");
            WEEKLY.classList.remove("active");
            MONTHLY.classList.remove("active");
            period = 'Yesterday';
        }
        else if(value === 'weekly'){
            WEEKLY.classList.add("active");
            DAILY.classList.remove("active");
            MONTHLY.classList.remove("active");
            period = 'Last Week';
        }
        else{
            MONTHLY.classList.add("active");
            DAILY.classList.remove("active");
            WEEKLY.classList.remove("active");
            period = 'Last Month';
        }

        document.querySelector("#work-value").innerText = `${d[0].timeframes[value]
            ["current"]}hrs`;
        document.querySelector("#previous-work-value").innerText = `${period} - 
            ${d[0].timeframes[value]["previous"]}hrs`;

        document.querySelector("#play-value").innerText = `${d[1].timeframes[value]
            ["current"]}hrs`;
        document.querySelector("#previous-play-value").innerText = `${period} - 
            ${d[1].timeframes[value]["previous"]}hrs`;

        document.querySelector("#study-value").innerText = `${d[2].timeframes[value]
            ["current"]}hrs`;
        document.querySelector("#previous-study-value").innerText = `${period} - 
            ${d[2].timeframes[value]["previous"]}hrs`;

        document.querySelector("#exercise-value").innerText = `${d[3].timeframes[value]
            ["current"]}hrs`;
        document.querySelector("#previous-exercise-value").innerText = `${period} - 
            ${d[3].timeframes[value]["previous"]}hrs`;

        document.querySelector("#social-value").innerText = `${d[4].timeframes[value]
            ["current"]}hrs`;
        document.querySelector("#previous-social-value").innerText = `${period} - 
            ${d[4].timeframes[value]["previous"]}hrs`;

        document.querySelector("#selfcare-value").innerText = `${d[5].timeframes[value]
            ["current"]}hrs`;
        document.querySelector("#previous-selfcare-value").innerText = `${period} - 
            ${d[5].timeframes[value]["previous"]}hrs`;
    };
    DAILY.addEventListener("click", () => {
        changeOption("daily");
    });
    
    WEEKLY.addEventListener("click", () => {
        changeOption("weekly");
    });
    
    MONTHLY.addEventListener("click", () => {
        changeOption("monthly");
    });

    document.addEventListener("DOMContentLoaded"changeOption("weekly"))

});


data();





Comentarios