1

I would like to remove the element that is high lighted in blue on the below screenshot.

If I add the following to the CSS

#p-tb body, { display:none }

it is still not removed.

Can someone explain what I am doing wrong?

enter image description here

3
  • You can't remove elements from the DOM using CSS; it's a common misconception that display: none removes elements from the DOM. You need to tell us what exactly you mean by "removing" the element.
    – BoltClock
    Commented Apr 19, 2012 at 21:28
  • 1
    This isn't an answer to your question but I notice an unrelated problem in your code that I thought I'd point out... you have a style tag between your closing /head and opening body tags. There shouldn't be anything between the head and the body so that style tag should be moved elsewhere (preferably into the head).
    – HMartch
    Commented Apr 19, 2012 at 21:28
  • @redlena Very interesting. It is MediaWiki 1.18.2 that we are looking at in the screenshot =) Commented Apr 19, 2012 at 21:32

3 Answers 3

4

#p-tb .body is the selector you need - you missed the . and have an extra , freeloading on the end.

EDIT: Although, even if you correct that, the inline style will override that rule, except maybe if you add !important after the display:none.

3
  • 3
    +1 And it's very clearly seen that the style is not applied .... (display: block; is the only display applied, inherited or shadowed or whatnot)
    – user166390
    Commented Apr 19, 2012 at 21:22
  • #p-tb .body { display:none !important} did the trick. What does !important do? Commented Apr 19, 2012 at 21:27
  • 1
    !important gives the property unusually high precedence. Normally inline style="..." attributes have higher precedence than any stylesheet will allow, but the !important overrides even that. That said, !important is usually seen a sign of poor design. Commented Apr 19, 2012 at 21:28
0

Display:none only hides the element. You can't remove an element via CSS.

Use javascript instead!

1
0

Be careful using display: none; on elements that can contain text. You could find yourself getting into SEO problems.

Not the answer you're looking for? Browse other questions tagged or ask your own question.