Support » Fixing WordPress » ::before at top of themes after admin bar removal – how to remove it?

  • Resolved Number_6

    (@number_6)


    Hello,

    I’ve looked for a solution, but it’s hard to search for that CSS selector with other keywords due to the colon.

    Pictured: https://prnt.sc/j2bvqn

    I used the following filter in functions.php
    add_filter('show_admin_bar', '__return_false');
    The admin toolbar doesn’t load, but a CSS :before is creating a gap at the beginning of the page about 22px high. Inspect Element isn’t giving me any clues and can’t find it in the CSS or override it in my child theme. This isn’t a new feature, I’ve just always patched it up with something like `margin-top: -22px;
    z-index: 99;` in the next div in the file. That probably isn’t best practice though since not all screens have the same resolution.

    If someone could point me to the CSS governing this selector or what in WordPress is rendering it, I’d be most grateful.

    Theme: Child Theme of TwentySixteen

    • This topic was modified 3 years, 8 months ago by Number_6. Reason: Fixing vauge sentence, adding my current theme info
Viewing 2 replies - 1 through 2 (of 2 total)
  • there is this style (line 2738 of style.css of Twenty Sixteen):

    @media screen and (min-width: 44.375em) {
    	body:not(.custom-background-image):before,
    	body:not(.custom-background-image):after {
    		background: inherit;
    		content: "";
    		display: block;
    		height: 21px;
    		left: 0;
    		position: fixed;
    		width: 100%;
    		z-index: 99;
    	}

    …..
    which might be causing your problem.

    there is also this style in the same section a few lines further down:

    	.site {
    		margin: 21px;
    	}
    Thread Starter Number_6

    (@number_6)

    Ace.

    I’ve overridden the theme’s @media screen z-index to -1 and .site’s margin to 0.

    Thanks!

    • This reply was modified 3 years, 8 months ago by Number_6.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘::before at top of themes after admin bar removal – how to remove it?’ is closed to new replies.