GG.
GG.

Reputation: 21874

CSS arrow rendering issue with Firefox

Context

I did a pure CSS tooltip with pseudo-element :before and :after for the arrow.

The rendering is different from Chrome 16 to Firefox 9 and 10.

You see what's wrong?

Chrome screenshot

enter image description here

Firefox screenshot

enter image description here

Demo

http://jsfiddle.net/wDff8/ reproduces the same issue.

Code

:

<span class="tooltip">Déposez votre fichier dans ce dossier</span>

:

span.tooltip {
  display: inline-block;
  background: #eee;
  margin-left: 20px;
  padding: 0 10px;
  color: #111;
  border-radius: 2px;
  border-top: 1px solid #bbb;
  border-right: 1px solid #bbb;
  border-bottom: 1px solid #bbb;
  line-height: 1.5;
  position: relative;
}

span.tooltip:before {
  content:"";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px;
  border-color: transparent #eee transparent transparent;
  left: -18px;
  top: -1px;
  z-index: 1;
}

span.tooltip:after {
  content:"";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 11px;
  border-color: transparent #bbb transparent transparent;
  left: -21px;
  top: -2px;
  z-index: 0;
}

body {
    font-family: Georgia;
    font-size: 12px;
    letter-spacing: 1px;
}

Upvotes: 5

Views: 2326

Answers (2)

GG.
GG.

Reputation: 21874

Solution

I juste removed a few pixels, which corrected the rendering on Firefox.

The rendering is not identical but close enough.

Chrome screenshot

enter image description here

Firefox screenshot

enter image description here

Demo

http://jsfiddle.net/wDff8/1/

Modified code

span.tooltip:after {
  border-width: 10px;
  left: -19px;
  top: -1px;
}

Upvotes: 1

sandeep
sandeep

Reputation: 92833

May be Instead of transparent you have to write this rgba(238,238,238,0)in your css check this for more

CSS Transparent Border Problem In Firefox 4?

Upvotes: 7

Related Questions