I am learning new and exciting information regarding CSS. I always thought that I had pretty good knowledge of CSS design principles but today is a great example that CSS has lots to learn and anyone can discover something new about the CSS structure. While going through Codecademy introduction to CSS I was able to learn about the attribute selector "The attribute selector can be used to target HTML elements that already contain attributes" so this means that element tags that are the same can be targeted uniquely by their attribute value. The website had a good example and I was able to understand more.
img[src*='winter'] {
height: 50px;
}
img[src*='summer'] {
height: 100px;
}
In the above CSS code, the attribute selector is used to target each image individually by looking specifically for the key value winter and summer within the image tags.
I can always learn something new by remaining curious and open.
Top comments (1)
thanks for sharing! 👍