Search code examples
htmlcssstyling

Remove Div Style from CSS using code (GroovePages)


I want to remove the badge at the bottom of my webpage using css. I don't know how to specify which div style I want to hide since it doesn't have a "class" label.

Please help me

As you can see I want to remove the sticky bottom footer that is identified inside the <div style="...">:

enter image description here


Solution

  • If the div does not contain a class or a unique id, then this can also be hidden by specifying some style rules through the style attribute in the css. Like this:

    div[style^="position: fixed; bottom: 0; height: 45px;"]
    

    The ^ sign will allow you not to specify all styles in divs, specifying only some.

    Just add this rule to your css.

    div[style^="position: fixed; bottom: 0; height: 45px;"] {
        display: none;
    }
    <div style="position: fixed; bottom: 0; height: 45px; background-color: black;">It shouldn't be seen</div>
    <div class="anyClass">1</div>
    <div class="anyClass">2</div>
    <div class="anyClass">3</div>
    <div class="anyClass">4</div>
    <div class="anyClass">5</div>

    But you can be even more precise and specify a selector with an empty class attribute using pseudo-class :not().

    div:not([class])[style^="position: fixed; bottom: 0; height: 45px;"]
    

    div:not([class])[style^="position: fixed; bottom: 0; height: 45px;"] {
        display: none;
    }
    <div style="position: fixed; bottom: 0; height: 45px; background-color: black;">It shouldn't be seen</div>
    <div class="anyClass">1</div>
    <div class="anyClass">2</div>
    <div class="anyClass">3</div>
    <div class="anyClass">4</div>
    <div class="anyClass">5</div>