CSS Flashcards
CSS stands for ____
Cascading Style Sheets
CSS is used to define styles for your _____
web pages, including the design, layout and variations in display for different devices and screen sizes.
p {
color: red;
}
Explain code
p is a selector in CSS (it points to the HTML element you want to style: <p>).
color is a property, and red is the property value
________ selects the HTML element(s) you want to style.
A CSS selector
The element selector selects HTML elements based on the ________
element name.
i.e. p, h1, h2
The id selector uses the id attribute of an HTML element to select a _____ element.
specific or 1 unique element
Syntax of ID selector:
#para1
{text-align: center;
color: red; }
p id=”para1”
The class selector selects HTML elements with a _______
specific class attribute.
Syntax of class selector
p.center {
text-align: center;
color: red; }
h1 class=”center”
________ selects all HTML elements on the page.
Universal selector (*)
Syntax of Universal selector
*
{
text-align: center;
color: blue;
}
The grouping selector selects all the HTML elements with the ________
same style definitions.
h1, h2, p {
text-align: center;
color: red;
}
Which are three Ways to Insert CSS
External CSS
Internal CSS
Inline CSS
________ sheet, you can change the look of an entire website by changing just one file!
External
External sheet syntax
<head>
link rel="stylesheet" href="mystyle.css"
</head>
An internal style sheet may be used if ________ has a unique style.
one single HTML page
<style>
body { background-color: red; }</style>
An inline style may be used to apply a unique style for a _____
single element.
h1 style=”color:blue; text-align:center;”
Cascading Order
What style will be used when there is more than one style specified for an HTML element?
Highest priority
1. Inline style (inside an HTML element)
2. External and internal style sheets (in the head section)
3. Browser default
A CSS comment is placed inside the <style> element, and starts and end with \_\_\_\_</style>
starts with /* and ends with */
The ________property specifies an image to use as the background of an element.
background-image
By default, the image is repeated so it covers the entire element.
Syntax of background-image:
background-image: url(“paper.gif”);
To repeat an image vertically, set _______
background-repeat: repeat-y;
To repeat an image horizontally, set _______
background-repeat: repeat-x;
Background should not repeat and show once, set ____
background-repeat: no-repeat
The ______property is used to specify the position of the background image.
background-position
background-position: right top;
The ______________property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page):
background-attachment
background-attachment: fixed;
background-attachment: scroll;
To shorten the code, it is also possible to specify all the background properties in one single property. This is called a ________ property.
shorthand
background: #ffffff url(“img_tree.png”) no-repeat right top;
When using the shorthand property the order of the property values is:
background-color
background-image
background-repeat
background-attachment
background-position
The ______property specifies what kind of border to display
border-style
solid - Defines a solid border
none - Defines no border
double - Defines a double border
hidden - Defines a hidden border
Border-width property
border-style: solid;
border-width: medium;
border-width: 2px;
border-width: thick;
Border-color property
border-style: solid;
border-color: red;
border-color: #ff0000;
border-color: rgb(255, 0, 0);
border-color: hsl(0, 100%, 50%);