CSS Flashcards
Remove underline from links
text-decoration: none;
style selected link and hover
nav a.selected, nav a:hover {
color: #32673f;
}
Google fonts
google.com/fonts
remove bullet points from lists
list-style: none;
clear floats in the footer
footer {
clear: both;
}
display navigation links as an inline block
nav li {
display: inline-block;
}
add a phone link
<a> 567 - 3455</a>
</a>
add a background img next to the phone link
.contact-info li.phone a {
background-image: url(‘../img/phone.png’);
}
change background-repeat to none
background-repeat: no-repeat;
shorthand for commenting something out
CMD + SHIFT + /
clear left float from every 4th img
#gallery li:nth-child(4n) { clear: left; }
import an external CSS file
@import “import-styles.css“; (at the beginning of the css file)
how to convert px to em
divide width in px by 16
style links on hover with rgba color property
a: hover {
color: rgba (255, 169, 73, .4)
}
change text to uppercase
text-transform: uppercase;
lowercase
capitalise;
underline h2
h2 {
text-decoration: underline;
}
change vertical spacing between lines of text
body {
line-height: 1.5;
}
add a solid blue border 10px wide
border: 10px solid blue;
center a div
margin: 0 auto;
universal selector
{ * }
selector for a visited link
a:visited
white color
fff
black color
000
change color with rgba
40% transparency
color: rgba (255, 170, 65, .4);
capitalize all paragraphs
p {
text-transform: capitalize;
}
change h1 to uppercase
h1 {
text-transform: uppercase;
}
change vertical spacing between rows of text
body {
line-height: 1.5;
}
specify that a <div>’s padding and borders are included in the total width and height of the element</div>
div {
box-sizing: border-box;
}