Currently Empty: $0.00
Course Preview
0/4
Introduction to HTML
0/7
Getting Started with HTML5
0/6
Deep into HTML5
0/12
Introduction to CSS
0/7
Deep Into CSS
0/8
Using Browser Developer Tools
0/2
Building Projects: Part 1 – for HTML & CSS
0/4
Building an NFT Website (HTML % CSS)
0/10
Making NFT Website Responsive (HTML % CSS)
0/7
Building an NFT Website (JavaScript)
0/4
Introduction to Git
0/1
Introduction To Javascript
0/8
Deep Into JavaScript
0/8
Advancing with JavaScript
0/6
JavaScript Interactivity with DOM
0/6
Building Project: Part 2 – for HTML, CSS and JavaScript
0/4
Deep Into Git and Github
0/2
Final Certification Examination
0/3
HTML Selector (type, class & id)
There are three types of HTML selectors namely,
- Type
- Class
- id
The id attribute provides you with the ability to give any element a unique identifier. This identifier can later be used to apply specific styles with CSS or capture input with some Javascript code.
id Selector
Exp
<h1 id="twitterUser"> Kynsofficial </h1>
You can apply CSS to the above code by calling twitterUser with the # sign
#twitterUser{
color: red
}
Â
What will happen if you run these two codes together?
Â

Â
Some notes about id usage:
Â
- an id value should only be used for a single element (you will get unexpected behaviour if you use the same id value for multiple elements)
- an id value must not contain any whitespace.
- The class attribute is similar to the id attribute in that it is used to identify specific elements.
Class Selector
Class selector for ExpÂ
<h1 class="twitterUser"> Kynsofficial </h1>
You can apply CSS to the above code by calling twitterUser with the . sign
.twitterUser {
color: red }
Â
The main distinctions are:
- The same class value can be used across multiple elements, and an element can have multiple class values separated by whitespaces

Â
Type Selector
Type selector for ExpÂ
You can apply the type selector here by calling the tag in your CSS with no prefix sign like the Class selector, which uses the . and Id selector, which uses #
<p> Kynsofficial <p>
Just type out the tag like so:
p {
color: red; }
Â
Let’s briefly assess your journey so far in the next lesson.
