-1

I have identified an inline style that I need to change. I cant locate how it got there or which specific rule I need to target to change it.

<div class="main-navigation-wrap main-navigation-sm d-lg-none is-active" style="top: 501px; height: 331px;"> 

This is what I want to over write when viewed in inspect element.

I want to remove the top to 0

I tried this:

.main-navigation-wrap .main-navigation-sm .d-lg-none .is-active

{
top: 0!important; 

}

and this:

.main-navigation-wrap .main-navigation-sm .d-lg-none .is-active          [style] {
top: 0!important;;
}

You can probably tell that my css knowledge is limited. How can I target and overwrite this inline style please.

Hexagon
  • 1
  • 1
  • 1
    Remove the spaces between the rules. But since you use !important, its enough to just write .main-navigation-wrap { top: 0 !important; } – elveti Jul 07 '19 at 20:29
  • Thank you. I get freaked out past very basic css. – Hexagon Jul 08 '19 at 22:07

2 Answers2

0

Your first CSS rule example was close, but since all of those classes belong to the same div, you can't have spaces between them. Also, generally speaking, you want a space before !important, e.g. top: 0 !important;:

.main-navigation-wrap.main-navigation-sm.d-lg-none.is-active
{
    position: relative;
    top: 0!important; 
}
<div class="main-navigation-wrap main-navigation-sm d-lg-none is-active" style="top: 501px; height: 331px;">THIS DIV</div>
symlink
  • 11,984
  • 7
  • 29
  • 50
0

As comments said, since you add !important it will change the inline style of the element.

The reason it is not - is that you point to a non-exist element. Your div have couple of classes and you need to choose to whom you want to change. Your markup is combination that doesn't exist.

Read here for css combinations on MDN

A. Meshu
  • 4,053
  • 2
  • 20
  • 34