CSS Flash Cards

What is CSS?
Answer: CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML or XML.
What are the three ways to include CSS in an HTML file?
Answer: Inline, Internal, and External
What is the syntax for selecting an element by its class in CSS?
Answer: .classname { ... }
What is the syntax for selecting an element by its ID in CSS?
Answer: #idname { ... }
What is the box model in CSS?
Answer: The box model refers to the layout design concept used to represent the different components of an HTML element, including content, padding, border, and margin.
What is the difference between padding and margin in CSS?
Answer: Padding is the space between an element's content and its border, while margin is the space between an element's border and surrounding elements.
What is the difference between absolute and relative positioning in CSS?
Answer: Absolute positioning positions an element relative to its parent element, while relative positioning positions an element relative to its normal position on the page.
What is the display property in CSS?
Answer: The display property determines how an element should be displayed on the page, such as block, inline, or none.
What is the difference between the float and clear properties in CSS?
Answer: The float property positions an element to the left or right of its container, while the clear property prevents elements from floating next to it.
What is the CSS box-sizing property?
Answer: The box-sizing property defines how the total width and height of an element is calculated, including padding and border, and can be set to content-box or border-box.
What is the difference between margin and padding in CSS?
Answer: Margin is the space outside an element, while padding is the space inside an element.
What is the box model in CSS?
Answer: The box model is a concept in CSS that describes the layout of elements on a web page as a series of boxes.
What is the difference between inline and block elements in CSS?
Answer: Inline elements are displayed in a line with other elements, while block elements are displayed on a new line.
What is the display property used for in CSS?
Answer: The display property is used to set how an element should be displayed on a web page.
What is the position property used for in CSS?
Answer: The position property is used to set the position of an element on a web page.
What is the difference between relative and absolute positioning in CSS?
Answer: Relative positioning is based on the element's position relative to its normal position, while absolute positioning is based on the element's position relative to the nearest positioned ancestor.
What is the z-index property used for in CSS?
Answer: The z-index property is used to set the stacking order of elements on a web page.
What is the float property used for in CSS?
Answer: The float property is used to set an element's position to the left or right of its container.
What is the clear property used for in CSS?
Answer: The clear property is used to specify whether an element should be moved below floating elements that come before it.
What is the font-size property used for in CSS?
Answer: The font-size property is used to specify the size of the font of an element.