0

Well, I've a Div like below in index.html

<div class="first">Hey This is it.</div>

first class definition.

   .first{
          width: 55px;
          height: 55px;
          color: green;
      }

I'm trying to inject a new Class named second from external file style.css (I can't edit this file) with it's definition like below.

    .second{
          color: blue;
      }

After injecting, I can see the element like below in index.html.

<div class="first second">Hey This is it.</div>

But Why div color is still with Green?? I want to get the div text color as Blue. How to acheive this?? Thanks.

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
Jenson M John
  • 5,499
  • 5
  • 30
  • 46
  • and if we don't see the **order** of your CSS we cannot help you – Temani Afif Aug 19 '19 at 19:54
  • The external stylesheet would need to come after the stylesheet that contains the .first class. – SROwl Aug 19 '19 at 19:55
  • I would make sure that your external file `style.css` is being read after your main CSS. So if both files are linked to in your HTML document make sure the file with the `.second` class is below the one with `.first`. CSS works as a cascade, so you may be overriding the `color: blue`. If this is not the case please give more information of how you are linking to the style sheets. I hope this helps. :-) – Nikki Pantony Aug 19 '19 at 20:01

0 Answers0