Skip to content

Commit 60b8b1a

Browse files
committed
activity 3.2.3
1 parent 4cf85a1 commit 60b8b1a

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

Activity_3.2.3/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<!--It's a best practice to always declare DOCTYPE!-->
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
<h1>Welcome to my page</h1>
10+
<h2 class="topSection">Top Section</h2>
11+
<p class="topSection">Classes and IDs are "attribute selectors". This means that you can attach style to HTML elements based on that element's attributes. This empowers you to apply different style to items of the same HTML type.Classes are an HTML attribute that specifies a name for a group of elements on the page. You can apply the class name to as many elements as you like, even if they are of different HTML tag types. You can use the class name with a period in front as the selector like so:</p>
12+
<ul class="topSection">
13+
<li>Class names must be single words</li>
14+
<li id="importantItem">but you can include digits and dashes as long as the name begins with a letter</li>
15+
<li>To apply a CSS rule to a class you use the class name preceeded by a period (".")</li>
16+
</ul>
17+
<h2 class="bottomSection">Bottom Section</h2>
18+
<p class="bottomSection">An ID is an HTML attribute that specifies a name or unique identifier for a particular HTML element. They are like classes with a very important distinction: the value of the ID attribute must be unique throughout the document. This lets you target a single HTML element for styling. You use the name with a hashtag in front as the selector like so. ID names have the same rules as class names: start with a letter, can include numbers and dashes, no spaces. The way to create a selector for an ID is also similar to how you create a selector for a class, except you replace the period with a hash symbol ("#") like in the code below.
19+
</p>
20+
<ul class="bottomSection">
21+
<li>How to use classes and IDs to independently target HTML elements of the same type</li>
22+
<li>How to apply different style to the same element based on the way the user interacts with that element using pseudo-classes</li>
23+
<li id="unimportantItem">What the "Cascading" part of "Cascading Style Sheets" means</li>
24+
<li>How to scope style rules using contextual selectors and the HTML inheritance structure of your document</li>
25+
</ul>
26+
</body>
27+
</html>

Activity_3.2.3/style.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
body {
2+
background-color: #00ccff;
3+
color: white;
4+
font-family: Helvetica, sans-serif;
5+
margin: 35px 25px 0px 25px;
6+
}
7+
p,h2 {
8+
padding: 10px;
9+
}
10+
.topSection{
11+
background-color: #3300cc;
12+
color: #cccccc;
13+
}
14+
.bottomSection {
15+
background-color: #cccccc;
16+
color: #3300cc;
17+
}
18+
#importantItem {
19+
text-decoration: underline;
20+
color: #99ff99;
21+
}
22+
#unimportantItem {
23+
color: gray;
24+
}

0 commit comments

Comments
 (0)