├── .devcontainer └── devcontainer.json ├── .github └── workflows │ └── learnpack-audit.yml ├── .gitignore ├── .gitpod.Dockerfile ├── .gitpod.yml ├── .learn └── assets │ ├── .gitkeep │ ├── 01-1.png │ ├── 01.1-1.png │ ├── 04.2-1.png │ ├── 06-1.png │ ├── 07-1.png │ ├── 08-1.png │ ├── 09-1.png │ ├── 12-1.png │ ├── 12-2.png │ ├── 13-1.gif │ ├── 4geeks-icon-blue.png │ ├── baby.jpg │ ├── background-vertical.jpg │ ├── einstein.png │ └── logo.ico ├── .vscode └── settings.json ├── LICENSE.md ├── README.es.md ├── README.md ├── css-badge.png ├── exercises ├── 00-welcome │ ├── README.es.md │ └── README.md ├── 01-inline-styles │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ └── tests.js ├── 02-style-tag │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ └── test.js ├── 02.1-add-a-style-tag │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ └── test.js ├── 02.2-rbga-colors │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ └── tests.js ├── 02.3-your-second-style │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ └── tests.js ├── 03-separate-stylesheet │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 03.1-background │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 04-list-styling │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── test.js ├── 05-class-selector │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ ├── styles.css │ └── test.js ├── 05.1-combined-rules │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 05.2-apply-several-classes │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ ├── styles.css │ └── test.js ├── 05.3-id-selector │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ ├── styles.css │ └── test.js ├── 06-specificity │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 07-practicing-rules │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 08-very-specific-rules │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 09-rounded-image │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 10-anchor-styles │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── 11-your-own-font │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── solution.hide.html │ ├── styles.css │ └── tests.js ├── 12-font-awesome-icons │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.html │ ├── styles.css │ └── tests.js ├── 13-relative-length-em-rem │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js └── 14-anchor-like-button │ ├── README.es.md │ ├── README.md │ ├── index.html │ ├── solution.hide.css │ ├── styles.css │ └── tests.js ├── learn.json └── preview.png /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node 3 | { 4 | "name": "Node.js", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/javascript-node:0-16", 7 | "customizations": { 8 | "vscode": { 9 | "settings": { 10 | "editor.defaultFormatter": "esbenp.prettier-vscode", 11 | "workbench.editorAssociations": { 12 | "*.md": "vscode.markdown.preview.editor" 13 | } 14 | }, 15 | "extensions": ["learn-pack.learnpack-vscode"] 16 | } 17 | }, 18 | 19 | // Features to add to the dev container. More info: https://containers.dev/features. 20 | // "features": {}, 21 | 22 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 23 | // "forwardPorts": [], 24 | 25 | "onCreateCommand": "npm i jest@29.7.0 jest-environment-jsdom@29.7.0 -g && npm i @learnpack/learnpack@5.0.13 -g && learnpack plugins:install @learnpack/html@1.1.7" 26 | 27 | // Use 'postCreateCommand' to run commands after the container is created. 28 | // "postCreateCommand": "yarn install", 29 | 30 | // Configure tool-specific properties. 31 | // "customizations": {}, 32 | 33 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 34 | // "remoteUser": "root" 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/learnpack-audit.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Learnpack audit 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [20.x] 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v2 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | - run: npm install @learnpack/learnpack@latest -g 29 | - run: learnpack audit -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | /* 3 | 4 | !.gitignore 5 | !.gitpod.yml 6 | !.gitpod.Dockerfile 7 | !bc.json 8 | !learn.json 9 | !README.md 10 | !README.es.md 11 | !.vscode 12 | 13 | !/exercises 14 | !/exercises/* 15 | 16 | !/.learn 17 | /.learn/** 18 | !/.learn/resets 19 | !/.learn/resets/** 20 | !/.learn/assets 21 | !/.learn/assets/** 22 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | FROM gitpod/workspace-full:latest 3 | 4 | USER gitpod 5 | 6 | RUN npm i jest@29.7.0 jest-environment-jsdom@29.7.0 -g && npm i @learnpack/learnpack@2.1.47 -g && learnpack plugins:install @learnpack/html@1.1.7 7 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | 2 | image: 3 | file: .gitpod.Dockerfile 4 | 5 | ports: 6 | - port: 3000 7 | onOpen: ignore 8 | 9 | vscode: 10 | extensions: 11 | - learn-pack.learnpack-vscode 12 | 13 | 14 | github: 15 | prebuilds: 16 | # enable for the master/default branch (defaults to true) 17 | master: true 18 | # enable for pull requests coming from this repo (defaults to true) 19 | pullRequests: false 20 | # add a "Review in Gitpod" button as a comment to pull requests (defaults to true) 21 | addComment: false 22 | -------------------------------------------------------------------------------- /.learn/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.learn/assets/01-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/01-1.png -------------------------------------------------------------------------------- /.learn/assets/01.1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/01.1-1.png -------------------------------------------------------------------------------- /.learn/assets/04.2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/04.2-1.png -------------------------------------------------------------------------------- /.learn/assets/06-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/06-1.png -------------------------------------------------------------------------------- /.learn/assets/07-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/07-1.png -------------------------------------------------------------------------------- /.learn/assets/08-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/08-1.png -------------------------------------------------------------------------------- /.learn/assets/09-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/09-1.png -------------------------------------------------------------------------------- /.learn/assets/12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/12-1.png -------------------------------------------------------------------------------- /.learn/assets/12-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/12-2.png -------------------------------------------------------------------------------- /.learn/assets/13-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/13-1.gif -------------------------------------------------------------------------------- /.learn/assets/4geeks-icon-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/4geeks-icon-blue.png -------------------------------------------------------------------------------- /.learn/assets/baby.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/baby.jpg -------------------------------------------------------------------------------- /.learn/assets/background-vertical.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/background-vertical.jpg -------------------------------------------------------------------------------- /.learn/assets/einstein.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/einstein.png -------------------------------------------------------------------------------- /.learn/assets/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4GeeksAcademy/css-tutorial-exercises-course/fb6e1472d9941920556d544d078e71f94be05eb0/.learn/assets/logo.ico -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.autoSave": "afterDelay", 3 | "files.autoSaveDelay": 700, 4 | "editor.minimap.enabled": false, 5 | "workbench.editorAssociations": { 6 | "*.md": "vscode.markdown.preview.editor" 7 | } 8 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | ## TERMS & CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 2 | 3 | By accessing Breathe Code we assume you accept these terms and conditions. Do not continue to use Breathe Code's content, applications or tutorials if you do not agree to take all of the terms and conditions stated on this page. 4 | 5 | Unless otherwise stated, Breathe Code and/or its licensors own the intellectual property rights for all material on Breathe Code. All intellectual property rights are reserved. You may access this from Breathe Code for your own personal use subjected to restrictions set in these terms and conditions. 6 | 7 | You must not: 8 | 9 | * Republish material from Breathe Code 10 | * Sell, rent or sub-license material from Breathe Code 11 | * Reproduce, duplicate or copy material from Breathe Code 12 | * Redistribute content from Breathe Code 13 | 14 | You can read the full version of Breathe Code's terms and conditions here: [Terms and Conditions](http://breatheco.de/terms-and-conditions) 15 | -------------------------------------------------------------------------------- /README.es.md: -------------------------------------------------------------------------------- 1 | # Tutorial de Ejercicios de CSS de 4Geeks Academy 2 | 3 | 4 | 5 | 6 | 12 | 13 |
7 | 8 | 9 | follow on Twitter 10 | 11 |
14 | 15 | ¡Hola! Soy [Alejandro Sanchez @alesanchezr](https://github.com/alesanchezr), ¡muy emocionado de tenerte aquí! 🎉 😂 Aprender a programar es difícil, ¡necesitas entrenamiento! [Envíame un DM en Twitter](https://twitter.com/alesanchezr) si tienes alguna pregunta. 16 | 17 | 18 | ## En este tutorial aprenderás los siguientes conceptos: 19 | 20 | 1. Cómo aplicar CSS a su sitio web de 3 maneras diferentes: en línea, agrupándolos dentro de una etiqueta ` 24 | Click me to open google.com 25 | ``` 26 | 27 | Tenemos un enlace de HTML `` que lleva a las personas a google.com cuando se hace clic. 28 | Usamos CSS para seleccionar todas las etiquetas `` y luego hacerlas rosa (`pink`). 29 | 30 | ## 📝 Instrucciones: 31 | 32 | 1. Pega este código en tu sitio web para ver los resultados. 33 | 34 | ## 💻 Vista previa: 35 | 36 | Debería verse así: 37 | 38 | ![Style tag resultado esperado](../../.learn/assets/01-1.png?raw=true) 39 | -------------------------------------------------------------------------------- /exercises/02-style-tag/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=iDwXZoQR8EM" 3 | --- 4 | # `02` Style tag in CSS 5 | 6 | Another way to apply styles, is by using a ` 24 | Click me to open google.com 25 | ``` 26 | 27 | We have an HTML anchor `` that takes people to google.com when clicked. 28 | We use CSS to select all the anchor tags and make them pink. 29 | 30 | ## 📝 Instructions: 31 | 32 | 1. Paste this code on your website to see the results. 33 | 34 | ## 💻 Preview: 35 | 36 | It should look like this: 37 | 38 | ![Style tag expected result](../../.learn/assets/01-1.png?raw=true) 39 | -------------------------------------------------------------------------------- /exercises/02-style-tag/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /exercises/02-style-tag/solution.hide.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | Click me to open google.com 8 | -------------------------------------------------------------------------------- /exercises/02-style-tag/test.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); 4 | document.documentElement.innerHTML = html.toString(); 5 | 6 | jest.dontMock('fs'); 7 | 8 | const a = document.querySelector("a"); 9 | 10 | test("There should be an anchor tag", ()=>{ 11 | expect(a).toBeTruthy() 12 | }) 13 | 14 | test("The anchor tag should be pink", ()=>{ 15 | let styles = window.getComputedStyle(a); 16 | expect(styles["color"]).toBe("pink"); 17 | }); 18 | 19 | test("There should be a href attribute pointing to 'https://google.com'", ()=>{ 20 | let href = a.getAttribute('href'); 21 | expect(href).toBeTruthy(); 22 | expect(href).toBe("https://google.com"); 23 | }) 24 | 25 | test("There should be a target attribute pointing to '_blank'", ()=>{ 26 | let target = a.getAttribute('target'); 27 | expect(target).toBeTruthy(); 28 | expect(target).toBe("_blank"); 29 | }) 30 | 31 | test("The anchor tag should not contain any inline style", ()=>{ 32 | let emptyBodyInlineStyle = {}; 33 | expect(a.style._values).toEqual(emptyBodyInlineStyle); 34 | }); 35 | -------------------------------------------------------------------------------- /exercises/02.1-add-a-style-tag/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=rX-0KNBCxrY" 3 | --- 4 | 5 | # `02.1` The Style Tag 6 | 7 | Veamos otro ejemplo pero esta vez agregando la etiqueta ` 14 | ``` 15 | 16 | ## 📝 Instrucciones: 17 | 18 | 1. Añade una etiqueta ` 14 | ``` 15 | 16 | ## 📝 Instructions 17 | 18 | 1. Add a ` 8 |

9 | Coding is a basic literacy in the digital age, and it is important for kids to understand and be able to work with and understand the technology 10 | around them. Having children learn to code at a young age prepares them for the future. Coding helps children with communication, creativity, 11 | math, writing, and confidence. 12 |

13 | -------------------------------------------------------------------------------- /exercises/02.1-add-a-style-tag/test.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); 4 | document.documentElement.innerHTML = html.toString(); 5 | 6 | jest.dontMock('fs'); 7 | 8 | const p = document.querySelector("p"); 9 | 10 | test("There should be a

tag", ()=>{ 11 | expect(p).toBeTruthy(); 12 | }) 13 | 14 | test("The

tag color should be blue", ()=>{ 15 | let styles = window.getComputedStyle(p); 16 | expect(styles["color"]).toBe("blue"); 17 | }); 18 | 19 | test("The

tag should not contain any inline style", ()=>{ 20 | let emptyBodyInlineStyle = {}; 21 | expect(p.style._values).toEqual(emptyBodyInlineStyle); 22 | }); 23 | -------------------------------------------------------------------------------- /exercises/02.2-rbga-colors/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=8RntHMOAFqI" 3 | --- 4 | 5 | # `02.2` Your First Style 6 | 7 | Cuando usas CSS, la idea es aplicar `reglas css` a tus `elementos html`, siempre debes seleccionar primero el elemento y luego especificar qué reglas deseas aplicarle: 8 | 9 | Por ejemplo, este es el código si quiero que todos los `anchors` de mi sitio web (etiquetas ``) sean azules (`blue`): 10 | 11 | ```css 12 | a { 13 | color: blue; 14 | } 15 | ``` 16 | 17 | ## 📝 Instrucciones: 18 | 19 | 1. En este momento, se está aplicando un estilo que se encarga de hacer el enlace rojo (`red)`. 20 | 21 | 2. Cambia el estilo para que tu enlace se vea amarillo (`yellow`). 22 | -------------------------------------------------------------------------------- /exercises/02.2-rbga-colors/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=TqmY9GLTwQ0" 3 | --- 4 | 5 | # `02.2` Your First Style 6 | 7 | When doing CSS, the idea is to apply `css rules` to your `html elements`, you always have to select the element first, and then specify what rules you want to apply to it: 8 | 9 | For example, this is the code if you want to make all your website anchors (`` tags) blue: 10 | 11 | ```css 12 | a { 13 | color: blue; 14 | } 15 | ``` 16 | 17 | ## 📝 Instructions: 18 | 19 | 1. Right now there is a style being applied that is responsible for making the anchor `red`. 20 | 21 | 2. Change the style to make your anchor look `yellow`. 22 | -------------------------------------------------------------------------------- /exercises/02.2-rbga-colors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | Hello! I am an anchor in red, change my color to yellow 13 | 14 | 15 | -------------------------------------------------------------------------------- /exercises/02.2-rbga-colors/solution.hide.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | Hello! I am an anchor in red, change my color to yellow 13 | 14 | 15 | -------------------------------------------------------------------------------- /exercises/02.2-rbga-colors/tests.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); 4 | document.documentElement.innerHTML = html.toString(); 5 | 6 | jest.dontMock('fs'); 7 | 8 | describe("All the styles should be applied", ()=>{ 9 | const a = document.querySelector("a"); 10 | 11 | test("The anchor tag should be yellow", ()=>{ 12 | let styles = window.getComputedStyle(a); 13 | expect(styles["color"]).toBe("yellow"); 14 | }); 15 | 16 | test("The tag should not contain any inline style", ()=>{ 17 | let bodyInlineStyle = document.getElementsByTagName("body"); 18 | let emptyBodyInlineStyle = {}; 19 | expect(bodyInlineStyle[0].style._values).toEqual(emptyBodyInlineStyle); 20 | }); 21 | 22 | test("The anchor tag should not contain any inline style", ()=>{ 23 | let emptyBodyInlineStyle = {}; 24 | expect(a.style._values).toEqual(emptyBodyInlineStyle); 25 | }); 26 | 27 | test("You should not change the existing tag elements", ()=>{ 28 | let head = document.querySelector('head') 29 | expect(head).toBeTruthy() 30 | 31 | let meta = head.querySelector("meta") 32 | expect(meta).toBe(null) 33 | }) 34 | }); 35 | -------------------------------------------------------------------------------- /exercises/02.3-your-second-style/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=vTS0D_QrbH8" 3 | --- 4 | 5 | # `02.3` Your Second Style 6 | 7 | Cuando usas CSS, la idea es aplicar `reglas css` a tus `elementos html`, siempre debes seleccionar primero el elemento y luego especificar qué reglas deseas aplicarle: 8 | 9 | Por ejemplo, este es el código si quiero que todos los anchors de mi sitio web (etiquetas ``) sean azules: 10 | 11 | ```css 12 | a { 13 | color: blue; 14 | } 15 | ``` 16 | 17 | ## 📝 Instrucciones: 18 | 19 | 1. Haz que el fondo de tu sitio web sea azul (blue) seleccionando el `body` y aplicando la regla `background` con valor `blue`. 20 | 21 | 2. Compila y muestra una vista previa del ejercicio y tu resultado debe ser un `body` azul (`blue`), es decir, toda la página azul. 22 | -------------------------------------------------------------------------------- /exercises/02.3-your-second-style/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=ituoKgAh6ds" 3 | --- 4 | 5 | # `02.3` Your Second Style 6 | 7 | When doing CSS, the idea is to apply `css rules` to your `html elements`, you always have to select the element first, and then specify what rules you want to apply to it: 8 | 9 | For example, this is the code if you want to make all your website anchors (`` tags) blue: 10 | 11 | ```css 12 | a { 13 | color: blue; 14 | } 15 | ``` 16 | 17 | ## 📝 Instructions: 18 | 19 | 1. Make your website background blue by selecting the `body` and applying the `background` rule with a `blue` value. 20 | 21 | 2. Run and preview the exercise and your result should be a blue `body` (the whole page blue). 22 | -------------------------------------------------------------------------------- /exercises/02.3-your-second-style/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | Hello! My background should be blue! 10 | 11 | 12 | -------------------------------------------------------------------------------- /exercises/02.3-your-second-style/solution.hide.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | Hello! My background should be blue! 13 | 14 | 15 | -------------------------------------------------------------------------------- /exercises/02.3-your-second-style/tests.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); 4 | document.documentElement.innerHTML = html.toString(); 5 | 6 | jest.dontMock('fs'); 7 | 8 | describe("All the styles should be applied", ()=>{ 9 | const body = document.querySelector("body"); 10 | 11 | test("The background should be blue", ()=>{ 12 | let styles = window.getComputedStyle(body); 13 | expect(styles["background"]).toBe("blue"); 14 | }); 15 | 16 | test("The body tag should not contain any inline style", ()=>{ 17 | let emptyBodyInlineStyle = {}; 18 | expect(body.style._values).toEqual(emptyBodyInlineStyle); 19 | }); 20 | 21 | test("You should not change the existing head tag elements", ()=>{ 22 | let head = document.querySelector('head') 23 | expect(head).toBeTruthy() 24 | 25 | let meta = head.querySelector("meta") 26 | expect(meta).toBe(null) 27 | }) 28 | }); 29 | -------------------------------------------------------------------------------- /exercises/03-separate-stylesheet/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=MmnkVGINtbs" 3 | --- 4 | 5 | # `03` Separate Stylesheet 6 | 7 | Si usas la etiqueta html ``, puedes tener tus estilos en un archivo separado que normalmente se llama `styles.css`. 8 | 9 | Esa es una mejor práctica porque te permite tener un sitio web sin diseño, puedes cambiar el CSS después y hacer que tu sitio web se vea 100% diferente, pero teniendo exactamente el mismo HTML. 10 | 11 | ## 📝 Instrucciones: 12 | 13 | Llena el `styles.css` con el contenido necesario para que el `body` del sitio web sea azul (blue). 14 | 15 | ## 💡 Pista: 16 | 17 | + Busca en Google cómo cambiar el color de fondo (`background-color`) del `body` de un sitio web. 18 | 19 | 20 | -------------------------------------------------------------------------------- /exercises/03-separate-stylesheet/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=jAfXzx88i-4" 3 | --- 4 | 5 | # `03` Separate Stylesheet 6 | 7 | If you use the html `` tag, you can also have your styles on a separate file that we usually call `styles.css`. 8 | 9 | That is an even better practice because it lets you have a CSS agnostic website, you can change the CSS later and make the website look 100% different, but still have the same exact HTML. 10 | 11 | ## 📝 Instructions: 12 | 13 | Fill the `styles.css` with the content needed to make the website's `body` blue. 14 | 15 | ## 💡 Hint: 16 | 17 | + Google how to change the `background-color` of a website's `body`. 18 | -------------------------------------------------------------------------------- /exercises/03-separate-stylesheet/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | My background should be blue. 8 | 9 | 10 | -------------------------------------------------------------------------------- /exercises/03-separate-stylesheet/solution.hide.css: -------------------------------------------------------------------------------- 1 | /* your styles here: 2 | 1. Select the body tag 3 | 2. Add the background rule equal to blue 4 | */ 5 | body { 6 | background: blue; 7 | } 8 | -------------------------------------------------------------------------------- /exercises/03-separate-stylesheet/styles.css: -------------------------------------------------------------------------------- 1 | /* your styles here: 2 | 1. Select the body tag 3 | 2. Add the background rule equal to blue 4 | */ 5 | -------------------------------------------------------------------------------- /exercises/03-separate-stylesheet/tests.js: -------------------------------------------------------------------------------- 1 | const fs=require("fs"); 2 | const path=require("path"); 3 | const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); 4 | const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); 5 | document.documentElement.innerHTML = html.toString(); 6 | 7 | jest.dontMock("fs"); 8 | 9 | describe("All the styles should be applied", ()=>{ 10 | const link = document.querySelector("link"); 11 | const body = document.querySelector("body"); 12 | 13 | test("The tag should not contain any inline style", ()=>{ 14 | document.querySelector("head").innerHTML = ``; 15 | let emptyBodyInlineStyle={}; 16 | expect(body.style._values).toEqual(emptyBodyInlineStyle) 17 | }); 18 | 19 | test("You should not change the existing tag elements", ()=>{ 20 | let head = document.querySelector('head') 21 | expect(head).toBeTruthy() 22 | 23 | let meta = head.querySelector("meta") 24 | expect(meta).toBe(null) 25 | 26 | let href = link.getAttribute("href") 27 | expect(href).toEqual('./styles.css') 28 | }); 29 | 30 | test("Your tag background color should be blue", ()=>{ 31 | let styles = window.getComputedStyle(body) 32 | expect(styles["background-color"]).toBe("blue") 33 | }) 34 | }); 35 | -------------------------------------------------------------------------------- /exercises/03.1-background/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=a1ACEu996z4" 3 | --- 4 | 5 | # `03.1` Background 6 | 7 | La regla `background` (fondo) de CSS nos permite asignar y trabajar con el background de cualquier contenedor (container). Los valores de background pueden ser `color` o una `imagen`. 8 | 9 | Si es una imagen, puedes especificar si quieres que la imagen se repita horizontalmente, verticalmente, ambas o ninguna, y también puedes especificar si quieres cambiar el tamaño y ajustar su tamaño al contenedor completo, entre otras propiedades, eso puede modificarse. 10 | 11 | ## 📝 Instrucciones: 12 | 13 | 1. Construye el ejercicio. 14 | 15 | 2. Verifica la vista previa. 16 | 17 | 3. En el archivo styles.css cambia el `background-size` a `contain` (verifica la pestaña styles.css). 18 | 19 | 4. Construye y previsualiza el ejercicio nuevamente. 20 | 21 | 5. Cambia el `background-repeat` a `repeat` para que se repita sobre el eje x y el eje y. 22 | 23 | 6. Construye y previsualiza el ejercicio nuevamente. 24 | 25 | ## 💡 Pista: 26 | 27 | Google es tu mejor amigo: 28 | 29 | - Recomendamos buscar en google `css background-size` para entender un poco mejor esta propiedad. 30 | 31 | - También recomendamos buscar `css background-repeat` 32 | -------------------------------------------------------------------------------- /exercises/03.1-background/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=fQh2OulBSp8" 3 | --- 4 | 5 | # `03.1` Background 6 | 7 | The `background` CSS rule allows us to assign and work with the background of any container. The background values can be a `color` or an `image`. 8 | 9 | If it is an image, you can specify if you want the image to be repeated horizontally, vertically, or both, or not at all, and you can also specify if you want it to resize and fit the whole container where it is being applied, among other properties that can be modified. 10 | 11 | ## 📝 Instructions: 12 | 13 | 1. Run the exercise. 14 | 15 | 2. Check the Preview. 16 | 17 | 3. On the styles.css file change the background-size to 'contain' (check the styles.css tab). 18 | 19 | 4. Run and Preview the exercise again. 20 | 21 | 5. Change the background-repeat to 'repeat' to make it repeat over the x-axis and y-axis. 22 | 23 | 6. Run and Preview the exercise again. 24 | 25 | 26 | ## 💡 Hint: 27 | 28 | Google is your best friend: 29 | 30 | - We recommend googling: `css background-size` and reading about it on w3schools or any other websites. 31 | - We also recommend googling about `css background-repeat`. 32 | -------------------------------------------------------------------------------- /exercises/03.1-background/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 03.1 Background 6 | 7 | 8 | My background should be an image with the size "contain" 9 | 10 | 11 | -------------------------------------------------------------------------------- /exercises/03.1-background/solution.hide.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url(https://4geeksacademy.github.io/exercise-assets/img/bg/small-mosaic.jpg); 3 | background-size: contain; 4 | background-repeat: repeat; 5 | } 6 | -------------------------------------------------------------------------------- /exercises/03.1-background/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url(https://4geeksacademy.github.io/exercise-assets/img/bg/small-mosaic.jpg); 3 | background-size: cover; 4 | background-repeat: no-repeat; 5 | } 6 | -------------------------------------------------------------------------------- /exercises/03.1-background/tests.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); 4 | const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); 5 | document.documentElement.innerHTML = html.toString(); 6 | 7 | jest.dontMock("fs"); 8 | 9 | describe("All the styles should be applied", ()=>{ 10 | const body = document.querySelector("body"); 11 | const link = document.querySelector("link"); 12 | const title = document.querySelector('title'); 13 | 14 | test("The tag should not contain any inline style", ()=>{ 15 | document.querySelector( 16 | "head" 17 | ).innerHTML = ``; 18 | let emptyBodyInlineStyle = {}; 19 | expect(body.style._values).toEqual(emptyBodyInlineStyle); 20 | }); 21 | 22 | test("the background-size should be 'contain' without quotes", ()=>{ 23 | document.querySelector( 24 | "head" 25 | ).innerHTML = ``; 26 | // get computed styles of any element you like 27 | let styles = window.getComputedStyle(body); 28 | expect(styles["background-size"]).toBe("contain"); 29 | }); 30 | 31 | test("the background-repeat should be 'repeat' without quotes", ()=>{ 32 | document.querySelector( 33 | "head" 34 | ).innerHTML = ``; 35 | 36 | let styles = window.getComputedStyle(body); 37 | expect(styles["background-repeat"]).toBe("repeat"); 38 | }); 39 | 40 | test("You should not change the existing tag elements", ()=>{ 41 | let head = document.querySelector('head') 42 | expect(head).toBeTruthy() 43 | 44 | let meta = head.querySelector("meta") 45 | expect(meta).toBe(null) 46 | 47 | const href = link.getAttribute("href") 48 | expect(href).toBe('./styles.css') 49 | 50 | let titleInner = title.innerHTML 51 | expect(titleInner).toBe('03.1 Background') 52 | }) 53 | }); 54 | -------------------------------------------------------------------------------- /exercises/04-list-styling/README.es.md: -------------------------------------------------------------------------------- 1 | --- 2 | tutorial: "https://www.youtube.com/watch?v=qcx31wUVmqI" 3 | --- 4 | 5 | # `04` List styling 6 | 7 | En el desarrollo front end, a menudo tenemos que listar ítems y la forma de hacerlo es con las etiquetas `