CSS Flashcards
p.center {
text-align: center;
color: red;
}
< p> elements with class=”center” will be center-aligned
- {
text-align: center;
color: blue;
}
Universal Selector
h1, h2, p {
text-align: center;
color: red;
}
grouped selectors
<link></link>
External CSS
hsla, rbga
color hsla(9, 100%, 64%, 0)
background-image: url(“paper.gif”);
background image
background-repeat: repeat-x;
repeat-x, repeat-y, no-repeat
background-attachment: fixed
fixed, scroll
background: #ffffff url(“img_tree.png”) no-repeat right top;
background shorthand
border-style: solid;
border-width: 5px;
dotted - Defines a dotted border
dashed - Defines a dashed border
solid - Defines a solid border
double - Defines a double border
groove - Defines a 3D grooved border. The effect depends on the border-color value
ridge - Defines a 3D ridged border. The effect depends on the border-color value
inset - Defines a 3D inset border. The effect depends on the border-color value
outset - Defines a 3D outset border. The effect depends on the border-color value
none - Defines no border
hidden - Defines a hidden border
border-width: 2px 10px 4px 20px;
border-width: 5px;
border-color: green;
border-color: red green blue yellow;
border: 5px solid red;
border-width
border-style (required)
border-color
border-left: 6px solid red;
background-color: lightgrey;
border-bottom: 6px solid red;
background-color: lightgrey;
border-left: 6px solid red;
background-color: lightgrey;
border-bottom: 6px solid red;
background-color: lightgrey;
margin: 25px 50px 75px;
top margin is 25px
right and left margins are 50px
bottom margin is 75px
margin: 25px 50px;
top and bottom margins are 25px
right and left margins are 50px
max-width
The value of the max-width property overrides width max-height max-width min-height min-width
outline-style outline-color outline-width outline-offset outline
outline: 5px solid yellow;
text-align
center / left/ right/ justify
a {
text-decoration: none;
}
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
text-transform
p.uppercase {
text-transform: uppercase;
}
p.lowercase {
text-transform: lowercase;
}
p.capitalize {
text-transform: capitalize;
}
text-indent
p {
text-indent: 50px;
}
letter-spacing
h2 {
letter-spacing: -3px;
}
line-height
p.small {
line-height: 0.8;
}
direction
The direction property is used to change the text direction of an element:
p {
direction: rtl;
}
word-spacing
h1 {
word-spacing: 10px;
}
font-family
font-family: “Times New Roman”, Times, serif;
font-weight
p.normal {
font-weight: normal;
}
p.thick {
font-weight: bold;
}
a: link - a normal, unvisited link
a: visited - a link the user has visited
a: hover - a link when the user mouses over it
a: active - a link the moment it is clicked
a: hover MUST come after a:link and a:visited
a: active MUST come after a:hover