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.
The transition property is shorthand for which four CSS properties?
It is a shorthand property for : transition-delay: transition-duration transition-property transition-timing-function
Give Two Examples of media features that you cna query in an @media rule
width, height, orientation
Which HTML meta tag is used in mobile-responsive web pages?
meta tag
What is a breakpoint in responsive Web design?
It is when the page changes the layout or parts of the layout depending on the width of to better suit various screen sizes.
What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a “column” class in a responsive layout?
Percentages better respond to breakpoints, the element will adjust the size depending on the parent node. which will be altered by screen size.
If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will “win”. Why is that?
Because of CSS Cascade order.