CSS Flashcards
What is the Box model in CSS? Which CSS properties are a part of it?
A rectangle box is wrapped around every HTML element. The box model is used to determine the height and width of the rectangular box. The CSS Box consists of Width and height (or in the absence of that, default values and the content inside), padding, borders, margin.
Actual Content of the box where the text or image is placed.
Content
Area surrounding the content (Space between the border and content).
Padding
Area surrounding the padding.
Border
Area surrounding the border.
Margin
How to include CSS in the webpage?
- External Style Sheet
- Embed CSS with a style tag
- Add inline styles to HTML elements
- Import a stylesheet file
The _______ works like a wildcard character, selecting all elements on a page. In the given example, the provided styles will get applied to all the elements on the page
Universal Selector
This selector matches one or more HTML elements of the same name. In the given example, the provided styles will get applied to all the ul elements on the page
Element Type Selector
This selector matches any HTML element that has an ID attribute with the same value as that of the selector. In the given example, the provided styles will get applied to all the elements having ID as a container on the page
ID Selector
The ____ selector also matches all elements on the page that have their class attribute set to the same value as the class. In the given example, the provided styles will get applied to all the elements having ID as the box on the page
Class Selector
The _____ selector or, more accurately, the descendant combinator lets you combine two or more selectors so you can be more specific in your selection method
Descendant Combinator
A selector that uses the child combinator is similar to a selector that uses a descendant combinator, except it only targets immediate child elements
Child Combinator
A selector that uses a ______ to match elements based on sibling relationships. The selected elements are beside each other in the HTML
General Sibling Combinator
A selector that uses the ____ uses the plus symbol (+), and is almost the same as the general sibling selector. The difference is that the targeted element must be an immediate sibling, not just a general sibling
adjacent sibling combinator
The ____ selector targets elements based on the presence and/or value of HTML attributes, and is declared using square brackets
Attribute