Skip to content

Commit bdca9c5

Browse files
committed
Minor styling changes; added like button to text absolute positioning.
1 parent 3b67dd4 commit bdca9c5

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

wip/03-CSS-Fundamentals/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ <h2>The Basic Language of the Web: HTML</h2>
4949
height="200"
5050
class="post-image"
5151
/>
52+
53+
<!--Because of the absolution position of this button, it'll be at the bottom, right corner.
54+
Because the button is inside the container now, it is absolute relative to the container
55+
element which is limited to 1200px wide.-->
56+
<button>❤️Like</button>
5257
</header>
5358

5459
<p>
@@ -148,6 +153,8 @@ <h4>Related posts</h4>
148153
<footer>
149154
<p id="copyright" class="copyright text">Copyright &copy; 2027 by The Code Magazine.</p>
150155
</footer>
156+
151157
</div> <!--This is the main div closure-->
158+
152159
</body>
153160
</html>

wip/03-CSS-Fundamentals/style.css

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,27 @@
55
padding: 0;
66
}
77

8+
/*PAGE SECTIONS*/
89
body {
910
color: #444;
1011
border-top: 10px solid #1098ad;
12+
position: relative;
13+
/*Any absolute items in this container must be in a relative container for absolute to work.*/
1114
}
1215

1316
.container {
1417
width: 1200px;
1518
/*This will split the page and center the content in the container.*/
1619
margin: 0 auto;
20+
position: relative;
1721
}
1822

1923
.main-header {
2024
background-color: #f7f7f7;
2125
padding: 20px 40px;
2226
margin-bottom: 60px;
23-
height: 80px;
27+
/*height: 80px;*/ /*This is normally not done; typically don't set a fixed height.*/
28+
height: auto;
2429
}
2530

2631
nav {
@@ -44,6 +49,7 @@ aside {
4449
width: 500px;
4550
}
4651

52+
/*SMALLER ELEMENTS*/
4753
h1, h2, h3 {
4854
color: #1098ad;
4955
}
@@ -103,10 +109,32 @@ li:last-child {
103109

104110
.post-image {
105111
/*This little trick maintains the aspect ratio.*/
112+
/*Images are inline-block elements by default.*/
106113
width: 100%;
107114
height: auto;
108115
}
109116

117+
nav a:link {
118+
margin-right: 30px;
119+
margin-top: 10px;
120+
display: inline-block;
121+
}
122+
123+
/*Chained psuedoclasses.*/
124+
nav a:link:last-child {
125+
margin-right: 0;
126+
}
127+
128+
button {
129+
font-size: 22 px;
130+
padding: 10px;
131+
cursor: pointer;
132+
position: absolute;
133+
bottom: 50px;
134+
right: 50px;
135+
136+
}
137+
110138
/*In the nth child, specify the number in ().
111139
li:nth-child(2) {
112140
color: red;
@@ -140,8 +168,6 @@ footer p {
140168
font-size: 16px;
141169
}
142170

143-
144-
145171
/*Class selector*/
146172
.related-author {
147173
font-size: 18px;

0 commit comments

Comments
 (0)