skip to Main Content

If I have written class="container bg-red" and in css I write .bg-red{background: red;} then it makes the background red so does that mean css will treat container{background: red;} and .containerbg-red{background: red;} the same way?

I tried .container{background:red;} and i worked but .containerbg-red{background:red;} didn’t work.

2

Answers


  1. class="container bg-red" means that you are applying both : class="container" and class="bg-red".

    Login or Signup to reply.
  2. Both container and bg-red is in the same level so you have to write .container.bg-red {} it will select an element with both the classes container and bg-red

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search