Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE and :first-of-type

I'm a beginner, so if u know other solution tell me ;) I want to make menu on my website look like this:

link / link / link / link / link

Menu is in so here's what I've made:

li:before {
    content: "/";
}

li:first-of-type {
    color: #FFF; /* I've made first "/" same color as background, so we don't see it */
}

There are some padding tags so it looks nice, but I want to make it simple to read for You.

In most browsers it looks fine, but of course older Internet Explorer doesn't support :first-of-type tag. How can I work it out, so the user don't see just the first slash?

like image 277
smogg Avatar asked Dec 06 '22 22:12

smogg


1 Answers

li:first-child:before {
    content: '';
}

The :first-child pseudo class is supported by IE7 and later.

Note that IE7 supports :first-child (with some caveats), but not until IE9 did it support its friend :last-child.

Also, to hide content added with content property, don't change the color to match the background color, as that is what I would call an ugly hack.

Instead, set its content to an empty string, like in the example above.

like image 175
alex Avatar answered Dec 31 '22 13:12

alex