Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox ::after pseudo element not working

Tags:

html

css

firefox

I have a CSS class which outputs a line after a title

enter image description here

This works in Safari and Chrome but in Firefox the line is not appearing.

My Code:

.sidebar h2 {
    color: #f7f7f7;
    width: 100%;
    font-size: 24px;
    position: relative;
}

.sidebar h2 span {
    background-color: #40d1b0;
    padding-right: 2px;
}
.sidebar h2::after {
    content:"";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0.22em;
    border-top: 1px solid rgba(0,0,0,0.10);
    z-index: -1;
}

<h2><span>Show</span></h2>

The container div has a class of Sidebar

EDIT

JSFiddle as requested

http://jsfiddle.net/jerswell/Lxsmt96k/

like image 631
Justin Erswell Avatar asked Sep 30 '22 02:09

Justin Erswell


1 Answers

The problem is the z-index, put a lower z-index to the sidebar class, so it won't be hidden anymore.

Here is a new fiddle, I have just simply put z-index: -2; to the .sidebar selector.

PS (nitpicking): In CSS3 after is not a pseudo-class but a pseudo-element, and there is a new notation for it: ::after (however the old notation still works)

like image 118
meskobalazs Avatar answered Oct 02 '22 17:10

meskobalazs