CSS Flashcards
In CSS, how do you select elements by their [class] attribute?
you have a . in front of the class.
for example:
.article
in CSS, how do you select elements by their type?
just type at the name of the type: h1, body, header, etc.
In CSS, how do you select an element by it [id] attribute
you use the #{name of idea) to select the element with the ID
Name three different types of values you can use to specify colors in CSS?
- RGB Values: rgb(xxx, xxx, xxx)
- Color Names: very light blue
- Hex codes (#xxxxxx)
What is the default value for the position property of HTML Elements?
Static
How does setting [position:relative;] on an element affect document flow?
It does not affect document flow
How does setting position: absolute on an element affect document flow?
It will be taken out of normal flow and other elements will ignore that element like it did not exist.
How does setting position: absolute on an element affect where it appears on the page?
It will position itself compared to its parent element that is NOT STATIC. If there is no non-static element, it will position itself against the Viewport/webpage.
How do you constrain an absolutely positioned element to a containing block?
Set position: (non-static:) to any of the parent elements.
What are the four box offset properties?
Top, Bottom, Left, Right
What are the four components of “the Cascade”
Source Order, inheritance, specificity, !imporant
What does the term “source order” mean with respect to CSS?
The order which the rules are written in your style sheet
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
You would set the value to inheritance;
List the three selector types in order of increasing specificity.
element type, id, class.
Why is using !important considered bad practice?
It breaks the natural css-cascading and it makes debugging harder.