Skip to content

Commit bce11d1

Browse files
committed
pseudo elements
1 parent 4c1632b commit bce11d1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

starter/03-CSS-Fundamentals/style.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,42 @@ button {
189189
bottom: 50px;
190190
right: 50px;
191191
}
192+
/* :: -> pseudo element
193+
: -> pseudo class
194+
+ -> adjacent element
195+
*/
196+
h1::first-letter {
197+
font-style: normal;
198+
margin-right: 5px;
199+
}
200+
/* h2::first-letter {
201+
font-size: 50px;
202+
} */
203+
204+
/* adjacent element can be selected using plus
205+
eg. select p which comes after h3 */
206+
/* h3 + p::first-line {
207+
color: red;
208+
} */
209+
210+
/* before and after pseudo elements */
211+
/* psedo elements are by default inline */
212+
h2 {
213+
/* background-color: orange; */
214+
position: relative;
215+
/* as we have set relative here, as per this parent only h2::after will be absolute */
216+
}
217+
h2::after {
218+
/* content is mandatory */
219+
content: "TOP";
220+
background-color: #ffe70c;
221+
color: #444;
222+
font-size: 16px;
223+
font-weight: bold;
224+
display: inline-block;
225+
padding: 5px 10px;
226+
227+
position: absolute;
228+
top: -10px;
229+
right: -25px;
230+
}

0 commit comments

Comments
 (0)