Skip to content

Commit f33e921

Browse files
committed
Added pseudo element to the post title, being a TOP post label, using ::before.
1 parent 25f13e8 commit f33e921

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

starter/03-CSS-Fundamentals/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h6>The Basic Language of the Web: HTML</h6>
1818

1919
<div class="container">
2020
<header class="main-header">
21-
<h1>📘 The Code Magazine</h1>
21+
<h1 class="website-title">📘 The Code Magazine</h1>
2222

2323
<nav>
2424
<!-- <strong>This is navigation</strong> -->
@@ -31,7 +31,9 @@ <h1>📘 The Code Magazine</h1>
3131

3232
<article>
3333
<header class="post-header">
34-
<h2>The Basic Language of the Web: HTML</h2>
34+
<h2 class="post-title">
35+
The Basic Language of the Web: HTML
36+
</h2>
3537

3638
<img
3739
src="img/laura-jones.jpg"

starter/03-CSS-Fundamentals/style.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,34 @@ nav a:link:last-child {
231231
right: 50px;
232232
}
233233

234+
.website-title::first-letter {
235+
font-style: normal;
236+
margin-right: 5px;
237+
}
238+
239+
/* Adjacent Sibling */
240+
h3 + p::first-line {
241+
/* color: red; */
242+
}
243+
244+
.post-title {
245+
/* background-color: orange; */
246+
position: relative;
247+
}
248+
249+
.post-title::before {
250+
content: "TOP";
251+
background-color: #ffe70e;
252+
color: #444;
253+
font-size: 16px;
254+
font-weight: bold;
255+
display: inline-block;
256+
padding: 5px 10px;
257+
position: absolute;
258+
top: -15px;
259+
right: -25px;
260+
}
261+
234262
/* Resolving conflicts */
235263
#copyright {
236264
color: yellow;

0 commit comments

Comments
 (0)