title | slug |
---|---|
Exercise: CSS Intro |
/css-intro-exercise |
Practice using CSS rulesets to add styles to web pages.
Steps are to be completed in your root directory (CSS_Exercise/
) and index.html
file.
- Create a new css file, named
index.css
, in your project's root directory - Create a link element nested in the
<head></head>
of yourindex.html
file, that contains an href attribute with a value that links to your newly created external stylesheet (don't forget to add a rel attribute to describe the linked content as a stylesheet*)
Steps are to be completed by writing css rulesets in your index.css
file.
- Add a
nav-link
class name to each anchor element on your page. - Create a ruleset in your
index.css
file that selects all elements withnav-link
class name - Create a declaration in your new ruleset that changes the text color of the
nav-link
elements to orange - Create a declaration in your new ruleset that changes the text decoration of the
nav-link
elements to none, to remove the default underline for links.
Steps are to be completed by writing css rulesets in your index.css
file.
- Create a ruleset in your
index.css
file that selects all elements with themain
tag name - Create a declaration in your new ruleset that changes the max width of the
main
elements to 600px - Create a declaration in your new ruleset that changes the margin top and margin bottom of the
main
elements to 24px, to center themain
elements between the left and right edges of the page (or their containing element). - Create a declaration in your new ruleset that changes the margin left and margin right of the
main
elements to auto, to center themain
elements between the left and right edges of the page (or their containing element).
Steps are to be completed by writing css rulesets in your index.css
file.
- Create a ruleset in your
index.css
file that selects all elements with thesection
tag name - Create a declaration in your new ruleset that changes the margin top and margin bottom of the
section
elements to 24px, to center thesection
elements between the left and right edges of the page (or their containing element). - Create a declaration in your new ruleset that changes the padding left, padding right, padding top and padding bottom of the
section
elements to 16px, to give thesection
elements space between their content and border.
Steps are to be completed by writing css rulesets in your index.css
file.
- Add a
title
id attribute to theh1
element in yourindex.html
file - Create a ruleset in your
index.css
file that selects the element with thetitle
id - Create a declaration in your new ruleset that changes the font size of the
title
element to 40px. - Create a declaration in your new ruleset that changes the font weight of the
title
element to 800, to give thetitle
element's text a bolded font weight.
Steps are to be completed by writing css rulesets in your index.css
file.
- Add a
d-inline
class name attribute to the currentli
elements in yourindex.html
file - Create a ruleset in your
index.css
file that selects the element with thed-inline
class name - Create a declaration in your new ruleset that changes the display of the
d-inline
elements to inline, to have each<li></li>
display as an inline element.
Steps are to be completed by writing css rulesets in your index.css
file.
- Create a ruleset in your
index.css
file that selects any<ul></ul>
element nested as a child of a<nav></nav>
element. Use the descendent selector. - Create a declaration in your new ruleset that changes the list style of the
nav > ul
elements to none, to remove the bullet points that are displayed by default for lists.
Steps are to be completed by writing css rulesets in your index.css
file.
- Create a ruleset in your
index.css
file that selects the<body></body>
element. - Create a declaration in your new ruleset that changes the background color of the
<body></body>
element to #222222. - Create a declaration in your new ruleset that changes the text color of the
<body></body>
element's text content to #EEEEEE.
Steps are to be completed by writing css rulesets in your index.css
file.
- Add an
avatar
id attribute to the<img>
element in yourindex.html
file. - Create a ruleset in your
index.css
file that selects the element with theavatar
id. - Create a declaration in your new ruleset that changes the width of the
avatar
element to 100px. - Create a declaration in your new ruleset that changes the margin left and margin right of the
avatar
element to auto. - Create a declaration in your new ruleset that changes the margin top and margin bottom of the
avatar
element to 32px.