CSS Flashcards
What does CSS stand for?
Cascading Style Sheets
How is CSS applied to HTML?
An HTML Link Tag
What are the two ways CSS can be applied to HTML?
- Ruleset
- Inline
What is the ruleset application of CSS?
A ruleset is defined either within the HTML document itself or in a sperate file with the .css extension.
What is the inline application of CSS?
CSS that is applied using the ‘style’ attribute in the HTML directly.
What are a few instances where inline style is commonly used?
- The style being applied to the markup is unique and won’t be repeated.
- The HTML markup is dynamically generated, and the CSS is static.
- Other situations where styling isn’t possible from a sperate file
What are the Ruleset Terms? (SDDPV)
- Selector
- Declaration Block { }
- Declaration
- Property
- Value
What are the Inline Style Terms?
- Opening Tag
- Attribute
- Declaration
- Property
- Value
When using the inline styling, how many styles can you add?
As many as you want, just keep adding the style attribute. Make sure they end with a semicolon every time.
Does the style attribute use double quotes or single quotes?
Either, just like any other attribute. (I totally knew this before I started learning CSS)… (totally)
How do you create an internal stylesheet?
Use the ‘< style >’element nested within the ‘< head >’ element. Once created you can code in CSS.
Where does the link to your CSS code need to be in the HTML?
Nested cozy inside of the ‘< head >’ element.
What two attributes does the ‘< link >’ need to have in order to work properly?
The ‘href’ attribute designating the location, and the ‘rel’ attribute describing the relationship, which in CSS’s case it’s ‘stylesheet’.
How do you decide which elements get a style?
A selector
How do you decide what style is applied to an element?
A declaration
What selector takes straight from the element in HTML?
The type selector. Also referred to as the tag name or element selector.
How do you select to style everything?
The universal selector which is denoted with a ‘*’
How do you select a class attribute in CSS?
Infront of the classes value, add a ‘.’
How can you create a correlation between multiple classes in HTML and CSS?
In the HTML class attribute add the values of the corresponding CSS styling. So ‘class=”bold green” in HTML and ‘.bold’ + ‘.green’ in CSS
What do you give an HTML element if it needs to be styled uniquely?
Give it the ‘id’ attribute. The id attribute’s value can only be used once per page.
What do you prepend the id with when styling in CSS?
Use the ‘#’ sign
What type of selector selects based off attributes?
An attribute selector
What surrounds an attribute when using the attribute selection method in CSS?
Brackets: [ ]
In CSS what is the syntax for selecting not only an attribute, but it’s value as well?
type[attribute*=’value’]
What are a few instances where pseudo-class selectors are at play?
- When text changes color to show that it is in focus
- When a link is clicked and upon return the originally blue text is purple
- When a button is greyed out before form completion but then normally colored to show that it’s active
How do you apply pseudo-classes to text?
Type the normal selector then choose a pseudo-class
What is the order from least specific selector to most specific?
- Type
- Class
- ID
A more specific selector will always override a less specific. It is best practice to use the lowest degree of specificity possible.
What is chaining and how would it look if you wanted all you ‘< h2 >’ elements with the ‘ class=”headerz” ‘ to be styled the same?
Chaining is using multiple selectors in one rule selection. That would look like: ‘ h2.headerz ‘
What is descendant selection and how do you use it?
Descendant selection selects all the children of an element using its class value. For example, if you wanted to style all the ‘< li >’ in an unordered list than the ‘< ul class=”listz” >’ would be selected:
.listz li (class then descendant elements)
How can you separate selectors and apply the same styling to multiple types?
Just use a coma
How do you change the type face on your website?
Use the property ‘font-family’