Login Register Appointment

Why isn’t my CSS style being applied to my element?

By Admin in 12 Sep 2024 | 11:19
Admin

Admin

Staff
Faithful User
Forums Top User
Posts: 10
Member since: 19 Aug 2020

I added a class to an element and defined styles in my CSS file, but the styles aren’t being applied. What could be the issue?

12 Sep 2024 | 11:19
0 Likes
Admin

Admin

Staff
Faithful User
Forums Top User
Posts: 10
Member since: 19 Aug 2020

There are a few reasons this might happen:


  • Class name mismatch: Make sure the class name in the HTML matches exactly with the one in the CSS (class names are case-sensitive).


<!-- Incorrect -->
<div class="container">

<!-- Correct -->
<div class="my-container">

/* Incorrect */
.My-container { color: red; }

/* Correct */
.my-container { color: red; }

  • CSS file not linked: Ensure the CSS file is properly linked in your HTML <head> section.

12 Sep 2024 | 11:21
0 Likes
login icon

Login to reply

Please login to reply to this topic

Report

Please describe about the report short and clearly.