[toc]

p) followed by curly brackets { }, with all the styling code (declarations) in between the brackets;h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
text-align: center;
}
h1, h2, h3, h4, h5, h6: the selector, aka what kinds of elements you are modifying (in this case, header elements){ and }: encapsulates the actual styling code in between themfont-family: what kind of font your website is using
font-family is the propertysans-serif is the value;text-align: How to justify the text on your page
text-align is the propertycenter is the value;TO-DO
- Create a new file in your code editor
- Copy and paste the code above into your file
- Save the file into your folder as style.css
<head> tags, directly under the <title> tags, copy and paste the following code:
<link rel="stylesheet" type="text/css" href="style.css"><html>
<head>
<title>Your Title Here</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h2>All your content is here~!</h2>
</body>
</html>
TO-DO
- Link your style.css page to your index.html page
p) are not styled because your CSS code has only defined the style (or selected) the header elementsp {
color: blue;
}
. in front of the class name, for reusable html elements.dogs {
text-align: center;
}
# in front of the element name, for unique html elements#goldenDog {
background-color: yellow;
}
* selector applies to every element on your sitebody instead of * since * applies to every single element* {
color: black;
}
color: defines text colorbackground-color: defines background color of that element (more on this next section)black, azure, maroon, etc.#66bbccrgb(100, 100, 100)body {
background-color: #edcee6;
}
TO-DO
- Modify the colors on your page as you see appropriate!
background-color: defines background color of that elementbackground-image: defines background of an element (such as a div) to be an imageurl(""imagelinkhere")url("pikachu.jpg")no-repeatrepeat (auto-set to this value)repeat-xrepeat-yleft, right, centertop, center, bottomleft bottomtop rightcenter center (auto-set to this value)scroll: background image scrolls with page (auto-set to this value)fixed: background image does not scroll with pagelocal: background image will scroll with the element’s contentsbody {
background-image: url("pikachu.jpg");
background-position: center center;
background-attachment: fixed;
}
Border: outline of element
Margin: Space outside element
Padding: Space inside element

border-styledotteddashedsolidgrooveridgeinsetoutsetnoneborder-widthpx2pxborder-colordiv {
border-style: dashed;
border-width: 2px;
border-color: green;
}
margin for all sidesmargin-top for top marginmargin-right for right marginmargin-bottom for bottom marginmargin-left for left marginpx25pxdiv {
margin: 10px;
}
padding for all sidespadding-top for top paddingpadding-right for right paddingpadding-bottom for bottom paddingpadding-left for left paddingpx25pxdiv {
padding: 10px 15px 20px 25px;
}
10px correlates to top padding, 15px correlates to right padding, 20px correlates to bottom padding, 25px correlates to bottom paddingfont-sizepx, eg: 12pxem, eg: 1.2emfont-family (what type of font is used)serifsans-serifmonospace
Including @import url('https://fonts.googleapis.com/css2?family=**Work+Sans**&display=swap'); in your style.css sheet allows you to use the “Work Sans” font!
TO-DO
- Add a custom font to your page!
height: height of imagewidth: width of image50%300pxobject-fitfill: fills entire element box, may be squished or stretchedcover: content ratio is maintained, but will fill entire element (aka it’ll be cropped)contain: content ratio is maintained, will fit into entire element (may have whitespace around)