Learn CSS by Building a Penguin- Step 59

Step 59

Target the .eye element with the left class, and position it 25% from the left of its parent. Then, target the .eye element with the right class, and position it 25% from the right of its parent.

My code:

.eye.left {
left: 75%;
}
.eye.right {
right: 75%;

}

My code didn’t pass and it keeps saying this –

You should give .eye.left a left of 25% , but found 75% .

Never mind I figured it out. I don’t understand why I have to put both percentages if it already did the same function and looks the same.

.eye.left {
left: 75%;
left: 25%
}
.eye.right {
right: 75%;
right: 25%;
}

In CSS, the order in which we specify our rules matters . If a rule from the same style sheet, with the same level of specificity, exists, the rule that is declared last in the CSS document will be the one that is applied.
In other words, your code has passed due to the rule explained above. The first property and corresponding value for both classes in your code don’t play any role.

1 Like

Thanks makes sense now.

1 Like