In Part 2, you’ll get comfortable with using CSS selectors and rules to dictate display, while keeping your styles separate from your content.
Go ahead and start adding styles in your
Your CSS must:
<body>element a margin value of 8px and a display type of block.
mainHeadingand use the id selector in
styles.cssto give it a color value of red.
testPand a class name of
funParagraph. Use the class selector in
styles.cssto give it a color value of green.
When you finish making your page look spiffy, take a moment to commit your changes on Git:
$ git add styles.css $ git commit -m "Added some killer CSS styling"
If you also made tweaks to your
index.html file, then you need to commit
those changes as well (along with a descriptive commit message):
$ git add index.html $ git commit -m "Changed title from 'My Favorite Puppies' to 'The Objectively Best Puppies'"
Incidentally, this is a good opportunity to address the question: Why does Git have two separate commands for ``add`` and ``commit`` if I always do them together anyway?
The answer comes back to the notion of collecting your changes in a “coherent
chunk of work” for each commit. The
add command gives you the opportunity
to specify exactly which file(s) should be included in the upcoming commit.
In the example above, this allowed us to perform two separate commits---each
with its own message describing its own chunk of work.
Note that you certainly can
add multiple files to the same commit. For
example, suppose you made changes to both
but those changes are all part of the same unit of work. In that case you would
add them both before committing:
$ git add index.html $ git add styles.css $ git commit -m "Added puppy image with thick yellow border"
There is a convenient shortcut,
git add ., for those (frequent) occasions
when you want to include every changed file without having to type each one
individually. The following example is equivalent to the previous one (assuming
you only changed
$ git add . $ git commit -m "Added puppy image with thick yellow border"
It is usually a good idea to check first (using
git status) before
git add ., so that you don’t mistakenly include unwanted
Go ahead and push your work to your remote repository using
git push and head over to Github to see how you did.