CSS Foundations Flashcards

1
Q

What does CSS stand for and what does CSS do?

A

Stands for Cascading Style Sheets and adds styling to a page like format, color, font size/type, etc. Basically, how a page looks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the basic syntax of a CSS rule?

A

The selector: the name of the rule
The property: what part of the element is being changed
Value: how that part of the element is being changed

.sample {
font-weight: 700px;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

(Selectors) What is the Universal Selector?

A

The symbol is * and takes the property and value and applies it to ALL elements in your code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

(Selectors) What are Type Selectors?

A

The selector is the name of a given element type like h1, p, div, etc. Used to apply properties to specific elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

(Selectors) What are Class Selectors?

A

The selector that applies styles to elements if that element contains that class. Uses the class attribute which is applied to an HTML element’s opening tag.

You can name it whatever you think is fitting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

(Selectors) What are ID Selectors?

A

Similar to class selectors, selects an element with the given ID. Should be used sparingly and used only for taking advantage of specificity to style an element. Can only have one ID for an element and cannot be repeated on a single page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

(Selectors) What are Chaining Selectors?

A

The selector that chains selectors together without any spaces. ONLY class selectors and ID selectors can be used with this selector, with the exception of just one type selector. Used to take advantage of specificity and style specific elements easier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

(Selectors) What are Grouping Selectors?

A

The selector that groups styles together where the selector names are separated by a comma and put on a new line. Any property and values inside this selector will apply to the grouped selectors. Used to reduce repetition and declarations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

(Selectors) What are Descendant Combinators?

A

This combinator allows us to combine multiple selectors by using the parent/nesting relationship HTML utilizes. Used to take advantage of styling certain elements with certain selectors if they are nested inside of another element with certain selectors. Suggested to avoid due to how complex it can get.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

(Font) What is the difference between a Font Family Name and a Generic Family Name?

A

Font Family Names (like Times New Roman) are presented using quotations (“ or ‘) because white space is between the words.

Generic Family Names (like sans-serif) do not require quotes, are lower case, and use hyphens if there are more than one word in the font name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

(Font) Why is it good to apply multiple fonts to your CSS?

A

Sometimes some fonts will not work with some browsers, so having back-up options for browsers to use is suggested.

Font Family Names tend towards the front of precedence and Generic Family Names are towards the back (as they aren’t widely preferred.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

(Image) Let’s say you have an image that is originally 250px tall and wide. What happens if you set the height to auto and the width to 500px? What does the value auto do in this case?

A

Adding auto to a height or width of an image while changing the size of the other property (height or width) will result in the image being changed proportionally. The height in this scenario will now be 500px as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

(Cascade of CSS) What is Specificity?

A

The more specific CSS Declaration will take precedence over less specific ones. Specificity takes into account once conflicting declarations or tie breakers are present.
Example: ID > Class > Type > *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

(Image) Why is it good to set height and width to an image even if you don’t plan on changing the original size of the image?

A

It’s suggested to add base height and width values to an image because the image may take longer to load in a website if that space isn’t already set for the image. If they’re not set, the image will take longer to load and all other elements will drastically change to fit the image once it loads in. It reserves the space for the image to load.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

(Cascade of CSS) What is Inheritance?

A

Inheritance refers to certain CSS properties that are inherited by that element’s descendants when applied to an element. Typography based properties are usually inherited, while most others are not. However, when directly targeting an element, that direct rule always beats inheritance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

(Cascade of CSS) What is Rule Order?

A

Rule order is the end of the line, the tie breaker of tie breakers. If there are still multiple conflicting rules targeting and element, whichever rule was last defined is the winner.

15
Q

(Adding CSS to HTML) What is External CSS?

A

External CSS is the most common method. It involves creating a separate file for the CSS and linking it inside of an HTML’s <head> tag with a <link></link> element.

The link element should similar to this:

<link></link>

16
Q

(Adding CSS to HTML) What is Internal CSS?

A

Internal CSS involves adding the CSS within the HTML file itself. We place all of our rules inside of <style> tags inside of the <head> tags. This can be used to add unique styles, but can cause the HTML file to get pretty big.</style>

17
Q

(Adding CSS to HTML) What is Inline CSS?

A

Inline CSS involves adding the CSS within the HTML element. You use the style attribute along with the properties and values you wish to apply. This can help add unique styles to a certain element, but is not preferred as things can get messy, repetitive, and unnecessarily bloated.

18
Q

Specifically, where does the <style> and/or <link></link> tag sit in an HTML page?</style>

A

Inside the <head>, after <meta></meta> and <title>.</title>

<head>
<meta></meta>
<link></link>
<style>

</head>
</style></head>
19
Q

True or False: If styles are used in a Grouping Selector, you cannot edit those selectors outside of the Grouping Selector.

A

False, you can!