Class Selector

Dear Sciaku Learner you are not logged in or not enrolled in this course.

Please Click on login or enroll now button.

If you have any query feel free to chat us!

Happy Coding! Happy Learning!

Lecture 40:- Class Selector

  1. A class selector in CSS is a type of selector that allows you to apply styles to elements with a specific class attribute. A class selector is denoted by a period (.) followed by the class name.

    For example, consider the following HTML code:

    cssCopy code

    <p class="highlight">This is a highlighted paragraph.</p> <p>This is a normal paragraph.</p>

    To style the first paragraph with a class of "highlight", you can use the following CSS code:

    cssCopy code

    .highlight {  background-color: yellow; }

    The CSS selector .highlight matches all elements with a class attribute of "highlight". In this case, the first paragraph will be styled with a yellow background. The second paragraph will not be affected because it does not have the "highlight" class.

    Multiple elements can have the same class, and a single element can have multiple classes. In this case, you can apply styles to all elements with a specific class, or a combination of classes. For example:

    pythonCopy code

    <p class="highlight special">This is a highlighted and special paragraph.</p> <p class="highlight">This is a highlighted paragraph.</p>

    You can use the following CSS code to apply styles to the first paragraph:

    cssCopy code

    .highlight.special {  background-color: green; }

    Here, the selector .highlight.special matches only the first paragraph with both "highlight" and "special" classes. The second paragraph will not be affected because it only has the "highlight" class.

5. Intro To CSS

Comments: 2

profile
@niteshguptav63
17-Nov-2024, 01:39 PM

I am not able to access videos from second class and further. I have already completed first class

profile
@niteshguptav63
16-Nov-2024, 10:56 AM

When will I get my course?

profile
@admin79
17-Nov-2024, 01:29 PM

Now, Your query was resolved.

Frequently Asked Questions (FAQs)

How do I register on Sciaku.com?
How can I enroll in a course on Sciaku.com?
Are there free courses available on Sciaku.com?
How do I purchase a paid course on Sciaku.com?
What payment methods are accepted on Sciaku.com?
How will I access the course content after purchasing a course?
How long do I have access to a purchased course on Sciaku.com?
How do I contact the admin for assistance or support?
Can I get a refund for a course I've purchased?
How does the admin grant access to a course after payment?