A2 - Intro to CSS
CSS, which stands for Cascading Style Sheet, is a language used alongside HTML to add just about every visual effect imaginable to our web pages.
For a demonstration, do the following:
-
Run
updatewithin your Google Drive folder for this class to download the new files -
Open Visual Studio Code
-
Open
What this line does is tell the web browser to look for the filea2-demo.htmland also open its live preview. While the live preview should look a lot different than assignment #1, the only difference in the HTML file is the addition of this line (it's the fifth line from the top):a2-demo.cssfor instructions on how to style the web page. -
Next, open the file
a2-demo.css. It has five sections, each described by a comment above it (comments in CSS are enclosed in/* ... */and are ignored by the web browser - their purpose is to help describe the code to someone reading it). -
Inside each section are lines of the form
We'll go through this together in class, but you may be able to understand some of it just by reading it through. For example, the first line within thebodysection is: This tells the browser that all text within the document body should be gold.
Reference for CSS
A good place to go for beginners is here.
While you certainly don't need to know all the details, these are good pages on this site to look at:
If you want help on a specific property name you see, it is useful to Google css followed by the property name.
For example, a web search for css text-decoration will provide detailed information.
Tip
Visual Studio Code will help you by providing a list of valid values for a property name. Try erasing the value beside one of the properties, so you're left with something like this:
Then press Ctrl+Space in the blank space to the right of this to bring up a suggestion box.
Your Task
-
Close all open documents in Visual Studio Code.
-
Open
a1.htmland also open its live preview. -
Insert the following line into
Your song lyrics should now be styled in the same way that my demo was.a1.htmlafter line 4 (with the<title>tags): -
Open
a2.css, and modify the values to customize the look to your liking. -
As an extension, you could look through the documentation linked above for new properties to add.