CSS Flashcards
What is the purpose of CSS?
Stands for Cascading Style Sheets
- Used to style a web page
- Describes how HTML elements are displayed on screens, paper, and other forms of media
- Saves a lot of time and work because it can format more than one webpage
- Defines styles for webpages, from layouts, design, and format, in the way it displays on screen
Describe the syntax of the CSS ruleset.
Consists of:
Selector (h1) - points towards the html element that will be styled
Declaration (property:value; property:value) - contains one or more declarations that are separated by semicolons. Also contains a CSS property name and value separated by a colon
Declaration blocks have curly braces around them
What are some characteristics of block?
- Displays an element as a block
- Starts on a new line and takes up the whole width
What are some characteristics of inline?
- Displays an element as inline
- Can start on the same line
- Height and width cannot be controlled
What are some characteristics of inline block?
- Displays an element as an inline-level block container
- Element is formatted as an inline element
- Can apply height width values
What is the default flex-direction of a flex container?
Contents will go horizontally from left to right
What is the default flex-wrap of a flex container?
Flex items will try to fit onto one line and wrap as needed
What is one of the uses of Flexbox?
Providing an efficient way to lay out, align, and distribute space among items in a container. Even when size is unknown and/or dynamic.
What are the three primary parts of a layout system?
- An element to be the container
- One or more elements acting as the row
- At least one column element in each of the row elements
In CSS, how do you select elements by their class attribute?
.classname
What are the names of individual pieces of a CSS rule?
selectors, declaration block, property, and value
In CSS, how do you select elements by their type?
elementname
In CSS, how do you select an element by its id attribute?
idname
Name three different types of values you can use to specify colors in CSS
Color Names (nameOfColor) Hex Codes (#(######)) RGB Values (rgb(100, 100, 100)
How do you write a comment in CSS?
/* comment here */
What CSS properties make up the box model?
Padding, margin, border, and content
Which CSS property pushes boxes away from each other?
Margin
Which CSS property adds space between a box’s content and its border?
Padding
What is a pseudo-class?
A class added to a selector that specifies a special state of the selected element.
Example using :hover can change an element when user’s pointer hovers over said element.
What are CSS pseudo-classes useful for?
Allows you to add style to an element that is not only content related
Name two types of units that can be used to adjust font-size in CSS
Pixels = precise number that makes up the units of a screen Percentages = percentage of 16px ems = width of the letter m