Ejercicio Layout

Crear un layout con flex (y todos los conocimientos adquiridos) parecido a este:

No tiene por qué ser igual, mucho menos el mismo tema, pero sí que tenga esas secciones, divisiones, etcétera. No tiene que ser responsive porque todavía no hemos hecho media queries.

Ejemplo flex

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="css/flex_ejemplo.css" rel="stylesheet"/>
</head>
<body>
    <head><img src="img/mascotas.jpg"><h1>Mis mascotas</h1>
    <h5>Tu mejor tienda de mascotas</h5></head>
    <div id="galeria">
        <div class="tarjeta"><h5>Gatito</h5><img src="img/gato.webp"/></div>
        <div class="tarjeta"><h5>Gatito</h5><img src="img/gato.webp"/></div>
        <div>  <div class="tarjeta"><h5>Gatito</h5><img src="img/gato.webp"/></div>
        <div class="tarjeta"><h5>Gatito</h5><img src="img/gato.webp"/></div></div>
      
        <div class="tarjeta"><h5>Gatito</h5><img src="img/gato.webp"/></div>
        <div class="tarjeta"><h5>Gatito</h5><img src="img/gato.webp"/></div>
               
       
    </div>
</body>
</html>

#galeria{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    height: 600px;
    background-color: bisque;
    align-content: stretch;
}
.tarjeta{
    background-color: chartreuse;
    border-style: solid;
    border-radius: 5px;
    border-width: 2px;
    margin: 1em;
    padding: .5em;
}
.tarjeta img{ /* pon estas propiedades a las img dentro de la clase tarjeta */
    width: 190px;
}
.tarjeta h5{
    color:red;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

Flexbox

Hoy hemos visto una manera más eficiente de maquetar, utilizando la propiedad Flexbox. En w3schools la explican bien:

https://www.w3schools.com/css/css3_flexbox.asp

http://www.emenia.es/flexbox-la-caja-flexible-css3/

Podemos ver las propiedades de una manera muy visual aquí:

https://demos.scotch.io/visual-guide-to-css3-flexbox-flexbox-playground/demos/

Aquí lo podemos ver animado:

https://jstutorial.medium.com/flexbox-the-animated-tutorial-8075cbe4c1b2
Flexbox el tutorial animado

Y aquí otra guía completa:

https://css-tricks.com/snippets/css/a-guide-to-flexbox/

Templates con flexbox:

https://www.quackit.com/html/templates/css_flexbox_templates.cfm

Cómo calcular como crecen y se encogen los elementos (no es tan sencillo como parece):

https://ed.team/blog/guia-definitiva-de-flexbox-2-flex-basis-flex-frow-flex-shrink

Ejemplos prácticos de cómo hacer cosas con flexbox:

https://www.sketchingwithcss.com/samplechapter/cheatsheet.html

18 recursos interesantes:

https://bashooka.com/coding/css3-flexbox-resources/

https://www.chenhuijing.com/blog/flexbox-and-absolute-positioning/

Un juego para aprender flexbox:

https://flexboxfroggy.com/#es

Layout

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/styles.css"/>
</head>
<body>
    <header>
        <h1>Tornillerías Martínez</h1>
    </header>
    <aside>
        <ul>
            <li>Inicio</li>
            <li>Productos</li>
            <li>Contacto</li>
        </ul>
    </aside>
    <main>
        <h2>Los mejores tornillos del mundo</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis temporibus exercitationem alias iure repellendus ad sed adipisci minus fuga voluptatibus sequi odit dolore, vel doloribus nobis recusandae quaerat iusto earum?</p>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati voluptates placeat quaerat corporis at quos earum mollitia inventore debitis, consectetur repellat soluta similique provident harum assumenda eum amet iste consequuntur.</p>
    </main>
    <footer>
        <p>(C) The Corner</p>
    </footer>
</body>
</html>

.cabecera{
    color: green;
    border-style:solid;
    border-right-color: blue;
    border-left-color: rgb(243, 132, 29);
    border-width: 10px; /* todos los bordes tienen 10px de ancho */
    border-width: 10px 5px; /* arriba y abajo tienen 10 izq y derecha 5 */
    border-width: 10px 5px 0; /* empezamos por arriba y seguimos las agujas del reloj */
 
}

.azuloscuro{
    color:#010157;
   /* font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-style: italic; /* lo pone en cursiva */
    /*font-weight:lighter; /* para ponerlo en negrita */
  /*  font-size:1rem; /* 1 rem = 16px */
  
    font: bold 1rem Arial;
    text-align: justify;
  
}
li{
    color:#ff7272;
}
table{
    width: 70%;
    margin: 20px auto;
}
th, td {
    border-style:dotted;
  }
  .contenedor{
    background-color: bisque;
    width:70%;
    margin: auto;
    padding-bottom: 20px;
    position: relative;
  }
  .articulos{
    width: 50%;
    background-color: aqua;
    margin: 20px auto;
    padding-left: 1em;
    text-align: center;
    position: absolute;
   top:50%;
   left:25%;
   width:50%;
  }
 
  header{
    background-color: aquamarine;
  }
  aside{
    background-color: gray;
    width: 33%;
    float: left;
    position: relative;
    bottom:-100px;
    right:40px;
  }
  main{
    background-color: darkkhaki;
    width: 66%;
    float: right;
  }
  footer{
    background-color: black;
    color: white;
    clear: both;
  }

Solución ejercicio HTML+CSS

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Informe de ventas</title>
    <link href="css/styles.css" rel="stylesheet"/>
</head>
<body>
    <h1>Informe de ventas</h1>
    <p class="azuloscuro">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <ul>
        <li>Ampliación oficinas</li>
        <li>Mayores comisiones</li>
        <li>Nuevos vendedores</li>
    </ul>
    <table >
        <thead>
        <tr>
            <th>Localidad</th>
            <th>Departamento</th>
            <th>Total</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td rowspan="2">Barcelona</td>
            <td>Muebles</td>
            <td>100</td>
        </tr>
        <tr>
            <td>Electrodomésticos</td>
            <td>200</td>
        </tr>
        <tr>
            <td>Tarragona</td>
            <td>Muebles</td>
            <td>50</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="2">Total</td>
            <td>350</td>
        </tr>
    </tfoot>
    </table>
</body>
</html>
h1{
    color: green;
}

.azuloscuro{
    color:#010157;
}
li{
    color:red;
}

th, td {
    border-bottom: 1px solid #ddd;
  }