HTML provides the structure for web pages and uses elements with tag names to differentiate items on the page. For example, <h1>...</h1>
is a large heading element. Notice the opening tag <h1>
and closing tag </h1>
that indicates the beginning and end of the element. "h1" is the tag name in this case.
Copy and past the HTML above into a new CodePen and notice how the browser preview looks.
Read these explanations on W3schools.com. Headings, Paragraphs, and Links
Add two more sites to the list with each having it's own "h3", "p", and "a" elements.
CSS stands for cascading stylesheets and allows us to modify the appearance of HTML elements in a browser. Study this W3schools page to understand the syntax of CSS. It is important to understand the concepts of a selector, property, and value.
Copy the CSS code above and add it to your CodePen from the HTML Exercise, and notice how the browser preview has changed.
Modify the CSS by changing colors and font-size.
Customize your look by adding the style properties below on the HTML elements you choose.
Box-shadow - This one is cool.
By assigning a class or id to an HTML element you can apply specific styles in a targeted way.
Copy the HTML and CSS above and paste it in a new CodePen.
Take a look at the browser preview and try to decipher what is going on.
Notice how assigning id="jill-card"
in the HTML allows the element to be "targeted" with the CSS selector #jill-card
.
Notice how assigning class="card"
in the HTML allows several elements to be "targeted" with the CSS selector .card
.
Go ahead and give Patrick's text a class of "card" and then add a unique id to his HTML element and some CSS to make his card stand out from all the others.
id - An HTML id is selected in CSS with a #
prefix and should be used to target a single element on a page.
class - An HTML class is selected in CSS with a .
prefix and can be used to select several elements that will share a common style.
Look at the HTML below. Do you see how the container could be called the parent of the three cards? The cards are then children of the container. This is an example of nested HTML.
Copy the HTML and CSS above into a new CodePen.
Notice in the browser preview how the nesting becomes visually apparent.
Also, notice how the indentation in the HTML is really helpful to see the proper structure. Technically the indentation does not need to be there, but it is a good programming practice.
Add a parent <div>
element with a class of "outer-container" to the container and style it with a solid border line. Use good indentation in your HTML.