Lesson 2: Applying ID and Class in CSS
In the previous lesson you learned about id and class attributes, and added both to the div elements that make up your portfolio home page. In this lesson, you will add styles to your external CSS file that will stylize each these elements.
At the completion of this exercise:
- you will be able to stylize a class of elements using CSS.
- you will be able to stylize an individual HTML element using its ID.
- If needed, review the examples in the previous lesson to be sure you understand how to define styles in CSS using ID's, Classes, and descendant selectors.
- Open your portfolio's external style sheet in a text editor, and your portfolio home page in a browser.
- Modify your CSS to stylize your page as follows:
- Control the width of the #skipnav div so that it's no wider than the content it contains (about 10em)
- Control the width of the .info class of div's so that both div's in this class have width:40%.
- Increase the font-size of the .info class so its text is larger and more prominent than other text on the page.
- Change the style of the #overview paragraph so that it stands out, as an overview should.
- Change the style of the .temp class of paragraphs so that they are italicized (font-style:italic), but no other paragraphs on the page are.
- Change the color and background-color of the main element so it stands out from surrounding content. Keep in mind what you learned in previous units about color. Since the main content of the page is where most reading takes place, it's especially critical that content inside this div have very good contrast between color and background-color.
- Add other styles as you see fit until you're satisfied with the appearance of your page. Especially try using some of the styles that you learned in recent lessons about typography and the box model.
Show your instructor your results before continuing on to the next lesson.