diff --git a/questions.md b/questions.md index 2b736e6..c8508a2 100644 --- a/questions.md +++ b/questions.md @@ -2,7 +2,7 @@ ## 1. Why does inline style CSS override rules defined in style elements and external stylesheets? - inline style CSS overrides external stylesheets because it's the most specific ruleset. Rules from external stylesheets might match the object, but if you know that this specific element should be styled differently, it could be written explicitly in the tag options of the element. However, best practise would be to use an ID. + inline style CSS overrides external stylesheets because it's the most specific ruleset. Rules from external stylesheets might match the object, but if you know that this specific element should be styled differently, it could be written explicitly in the tag options of the element. However, in this case it would be best practise to use an ID and specify the rules in a stylesheet. ## 2. Give a brief example of when to use ID ( #id ) and when to use classes ( .class ) in CSS. @@ -12,7 +12,7 @@ RGBA is an acronym meaning "Red, Green, Blue, Alpha" where the three first represent subpixel brightness values and the fourth represents opacity. With the RGB colors, you can express most colors that anyone can think of on the top of their head. Usually, we express them with a bitdepth of 8, meaning you can specify each individual color value to a range of 2^8 values -> between 0 and 255. With the alpha channel added, we can also specify how transparent the color should be. This is especially useful for things like non-square icons, watermarks and in web development - see-through floating windows. An example of a color that could be expressed with RGBA would be a 50% seethrough yellow, RGB(255,255,0, 127), or with alternative hexadecimal syntax -> #FFFF007f. - Note that the actual amount of colors you can express with RGBA depends on several other factors like your monitor, the colorspace, the brightness in the room you're sitting + Note that the actual amount of colors you can express with RGBA depends on several other factors like your monitor, the colorspace, the brightness in the room you're sitting. ![Diagram showing hue along the x axis and opacity along the y axis](https://upload.wikimedia.org/wikipedia/commons/0/0b/RGBA_comp.png) @@ -22,7 +22,17 @@ ## 5. What CSS selector matches all the p elements inside the article element in the following HTML? - Here, we have two options. One could either do + ```HTML +

This should not match.

+
+

This should not match

+

This should match.

+

This should also match.

+

Do not forget about this one!

+
+ ``` + + Here, we have two options. You could either do ```CSS article p {} @@ -30,10 +40,10 @@ which specifies all `

` elements inside the `

`. - The other options would be + The other option would be ```CSS article > p {} ``` - which would only specify `

` elements directly beneath the `

`. But since there are no `

` subchildren, both will work. + which would only specify `

` elements directly beneath the `

`. But since `
` has no `

` subchildren, both will work.