How to Use CSS Pseudo-Classes

  Рет қаралды 1,737

Craig A. Bourne

Craig A. Bourne

Күн бұрын

► Pseudo-classes specify a unique state of the element that has been triggered due to user interaction.
A common pseudo-class that we are all familiar with is the :hover.
Our pages will usually be full of links and buttons for users to click, and we would ordinarily set separate styles that only come in to force when the user hovers their cursor over the element. This change in styles informs the user that the element is interactive and can be clicked.
For example - a:hover { }
In this video, we will look at the :hover pseudo-class, plus
:visited
:link
:root
:first-child
:last-child
:first-of-type
:last-of-type
:nth-child() + nth term, and odd & even keywords
:disabled
:checked
:required
:not ( )
In addition to these, we will discuss visited links and privacy, and take a brief look at the CSS concept of specificity.
► Timestamps:
0:00 Start
1:49 - GitHub Repo
2:06 - CodePen
2:55 - :hover
5:49 - :visited & link
7:14 - Privacy and the :visited selector:
8:45 - :root
10:09 - Brief word on specificity
12:35 - :first-child & :last-child
13:40 - :first-of-type & :last-of-type
17:03 - :nth-child()
19:50 - :nth-child() - odd & even keywords
20:36 - Using :nth-child() to style table rows
21:00 - :disabled
22:42 - :checked
23:24 :required
24:00 Negation :not()
► Get the code:
GitHub Repo: github.com/craigabourne/css-p...
CodePen Start: codepen.io/craigabourne/pen/Z...
CodePen End: codepen.io/craigabourne/pen/V...
Code Pen Even/Odd: codepen.io/craigabourne/pen/x...
CodePen :not(): codepen.io/craigabourne/pen/x...
Nth-child table row: codepen.io/craigabourne/pen/x...
► Links used in the video:
MDN Selectors: developer.mozilla.org/en-US/d...
MDN Pseudo Classes: developer.mozilla.org/en-US/d...
Privacy and the :visited selector: developer.mozilla.org/en-US/d...
CSS Specificity: css-tricks.com/specifics-on-c...
► Other types of CSS Selectors:
Element, Class, & ID Selectors: • CSS Selector Basics - ...
Child & Descendant Selectors: • CSS Child and Descenda...
Sibling Selectors: • Adjacent and General S...
Universal & Attribute Selectors: • Universal and Attribut...
Pseudo-elements: • How to Manipulate Cont...
► This video is part of the CSS for Absolute Beginners playlist: • CSS for Absolute Begin...
► Social Media:
/ craigabourne
/ craigabourne
► Code & Projects:
github.com/craigabourne
codepen.io/craigabourne

Пікірлер: 21
@craigabourne
@craigabourne 3 жыл бұрын
Learn CSS: kzbin.info/aero/PL4cTxE4s2XIYwGURywyDlkfmhmRC5FaUR
@shilohdalby8447
@shilohdalby8447 2 жыл бұрын
I lay my mark here, the best pseudo class tutorial on youtube
@craigabourne
@craigabourne 2 жыл бұрын
Thank you 🙏
@somnarchaudhary
@somnarchaudhary 3 жыл бұрын
Ah man. This is sooo good. You are genuinely one of the best actual teachers in the code space. Wishing big things for you. Every video is fire
@craigabourne
@craigabourne 3 жыл бұрын
Wow, thank you! Really appreciate it.
@marinstrup
@marinstrup 2 жыл бұрын
Thank you so much! Your video is exactly what I need as I just started with CSS. You have the best videos. Keep it up!
@craigabourne
@craigabourne 2 жыл бұрын
Thanks, will do!
@georgeepohcuaw2545
@georgeepohcuaw2545 2 жыл бұрын
Totally new perspective on pseudo classes. Thx a ton.
@craigabourne
@craigabourne 2 жыл бұрын
You're welcome!
@balaeinstein8710
@balaeinstein8710 3 жыл бұрын
This css content is phenomenal . Thanks a lot sir. Please continue this series
@craigabourne
@craigabourne 3 жыл бұрын
Thanks, I really appreciate it! There will be around 40 CSS vids in total eventually 👍
@balaeinstein8710
@balaeinstein8710 3 жыл бұрын
@@craigabourne eagerly waiting sir😊
@besjanaelezi
@besjanaelezi 3 жыл бұрын
Thanks Craig, I would like to make 100 likes but not possible 😍 You have build a trust over your videos. I would always search in your channel better than Google. Even if i use google, I type your name to check your contents which are better than others. Keep up amazing work 👍
@craigabourne
@craigabourne 3 жыл бұрын
Wow, thank you! Love it. Means a lot ❤️
@kajabrooks
@kajabrooks 3 жыл бұрын
Amazing again! Keep going 👍
@craigabourne
@craigabourne 3 жыл бұрын
Thank you! Will do!
@gambo2003
@gambo2003 3 жыл бұрын
Thank u for the amazing content
@craigabourne
@craigabourne 3 жыл бұрын
My pleasure!
@sophiawokoma3711
@sophiawokoma3711 2 жыл бұрын
I was wondering if you could help, I downloaded the file into vs code , but for some reasons any changes that I make in the start code for the pseudo.css, does not display in the browser , what reasons could there be for this ?
@craigabourne
@craigabourne 2 жыл бұрын
Hi Sophie! That is strange. I have just tried it myself and it is working fine for me. The only thing I can think of is that you are not refreshing the browser after making a change. You can get a great extension in VS Code called Live Server that does this automatically for you (marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer or just search 'live server' in the extension tab in VS Code). To make it work, add the extension, then right-click your index.html file and select 'Open with Live Server'. It will open in your default browser. Then any change you make will be automatically shown. Hope that helps! If not let me know.
@ovidiu2394
@ovidiu2394 2 жыл бұрын
:hi
How to Manipulate Content With CSS Pseudo-Elements
16:27
Craig A. Bourne
Рет қаралды 2,2 М.
Universal and Attribute Selectors in CSS
17:53
Craig A. Bourne
Рет қаралды 1,6 М.
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 56 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 85 МЛН
Super gymnastics 😍🫣
00:15
Lexa_Merin
Рет қаралды 108 МЛН
CSS Selector Basics - Element, Class, and ID
32:14
Craig A. Bourne
Рет қаралды 3,2 М.
Using CSS Units correctly: Pixels and Percentages
12:10
Craig A. Bourne
Рет қаралды 3,1 М.
Adjacent and General Sibling Selectors in CSS
16:45
Craig A. Bourne
Рет қаралды 2,2 М.
Mastering CSS Positioning Once and For All
22:12
Craig A. Bourne
Рет қаралды 9 М.
Mastering the CSS Box Model
21:16
Craig A. Bourne
Рет қаралды 3,9 М.
Inline vs Internal vs External CSS
18:00
Craig A. Bourne
Рет қаралды 2,9 М.
CSS Child and Descendant Selectors
13:13
Craig A. Bourne
Рет қаралды 2,6 М.
The Only Markdown Crash Course You Will Ever Need
22:16
Web Dev Simplified
Рет қаралды 77 М.
Ems & Rems: How to use CSS Units
13:51
Craig A. Bourne
Рет қаралды 2,3 М.
Learn Every CSS Selector In 20 Minutes
19:38
Web Dev Simplified
Рет қаралды 439 М.
Asus  VivoBook Винда за 8 часов!
1:00
Sergey Delaisy
Рет қаралды 1,1 МЛН
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 2,1 МЛН
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 4,1 МЛН