Skip to content

Commit b500553

Browse files
Merge pull request 4GeeksAcademy#101 from josemoracard/jose2-04.1-combined-rules
changes in exercise 04.1-combined-rules
2 parents b50a868 + 2d300ed commit b500553

File tree

4 files changed

+25
-33
lines changed

4 files changed

+25
-33
lines changed

exercises/04.1-Combined-Rules/README.es.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ border: black 1px solid;
2121

2222
1. Combina las 4 reglas de padding en una sola utilizando la regla `padding`.
2323

24-
2. Combina todas las reglas de background, menos el `background-size`, en una sola línea usando la regla `background:`.
24+
2. Combina todas las reglas de background en una sola línea usando la regla `background`.
2525

26-
*El `background-size` no se puede combinar, los navegadores aún no lo admiten.*
26+
*Las propiedades `background-position` y `background-size` pueden usar el mismo tipo de datos por lo que entrarán en conflicto, así que en vez de separar estas propiedades con un **espacio**, debes separarlas con una barra `/` de esta forma:*
27+
28+
```css
29+
background: 50px / cover
30+
```
31+
32+
Donde el valor de la izquierda de la barra `/` es la propiedad `background-position` y la derecha es el `background-size`.
2733

2834
## 💡 Pista:
2935

30-
- Cómo usar el background-size: http://lmgtfy.com/?q=css+background
31-
- Cómo usar el padding: http://lmgtfy.com/?q=css+padding
36+
- Cómo usar el background: https://www.w3schools.com/cssref/css3_pr_background.php
37+
- Cómo usar el padding: https://www.w3schools.com/css/css_padding.asp

exercises/04.1-Combined-Rules/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
tutorial: "https://youtu.be/watch?v=uQS5QeEE-B4"
3-
---
4-
51
# `04.1` Combined Rules
62

73
CSS files take up space on your server and also take time to download (like everything); it is yet another text document that the browser has to download before rendering the page, which is why it's important to keep the CSS document as small as possible.
@@ -22,14 +18,20 @@ border: black 1px solid;
2218

2319
## 📝 Instructions:
2420

25-
1. Combine the 4 padding rules into just one using the `padding` rule.
21+
1. Combine the 4 padding rules into only one using the `padding` rule.
22+
23+
2. Combine all background rules into only one using the `background` rule.
24+
25+
*The `background-position` and the `background-size` properties will conflict because they can handle the same type of values, so instead of separating these properties with a `space` you must separate them with a forward slash `/` as follows:*
2626

27-
2. Combine all background rules, but the `background-size`, into just one line using the `background:` rule.
27+
```css
28+
background: 50px / cover
29+
```
2830

29-
*The `background-size` cannot be combined, the browsers don't support it yet.*
31+
Where the left side value of the forward slash `/` is the `background-position` rule and the right value is the `background-size` rule.
3032

3133
## 💡 Hint:
3234

33-
- How to use the background-size: http://lmgtfy.com/?q=css+background
35+
- How to use the background: https://www.w3schools.com/cssref/css3_pr_background.php
3436

35-
- How to use the padding: http://lmgtfy.com/?q=css+padding
37+
- How to use the padding: https://www.w3schools.com/css/css_padding.asp

exercises/04.1-Combined-Rules/solution.hide.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
height: 50px;
44
padding: 10px 190px 50px 30px;
55

6-
background: rgb(189, 189, 189) url(https://github.com/4GeeksAcademy/css-tutorial-exercises-course/blob/3a2d1dd03f58167a5a4894155af2d3aa4d41d647/.learn/assets/baby.jpg?raw=true) no-repeat 100px;
7-
background-size: contain;
8-
}
6+
background: rgb(189, 189, 189)
7+
url(https://github.com/4GeeksAcademy/css-tutorial-exercises-course/blob/3a2d1dd03f58167a5a4894155af2d3aa4d41d647/.learn/assets/baby.jpg?raw=true)
8+
no-repeat 100px / contain;
9+
}

exercises/04.1-Combined-Rules/tests.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,6 @@ describe("All the styles should be applied", ()=> {
5555
expect(orangeHoverSelector).toBe('50px');
5656
});
5757

58-
test("The background-size should be 'contain'", ()=> {
59-
document.querySelector(
60-
"head"
61-
).innerHTML = `<style>${css.toString()}</style>`;
62-
63-
let cssArray = document.styleSheets[0].cssRules;
64-
let orangeHoverSelector = "";
65-
66-
for (let i = 0; i < cssArray.length; i++) {
67-
if (cssArray[i].selectorText === ".myBox") {
68-
orangeHoverSelector = cssArray[i].style['background-size'];
69-
}
70-
}
71-
72-
expect(orangeHoverSelector).toBe('contain');
73-
});
74-
7558
test("The background should include the shorthand property", ()=> {
7659
document.querySelector(
7760
"head"

0 commit comments

Comments
 (0)