Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox CSS3 isosceles triangle rendering issues

I'm trying to create a isosceles triangle using CSS3 and looks like Firefox can't render them properly?

Is there a way of fixing that?

Here's an example:

http://jsfiddle.net/WajLY/1/

CSS:

.arrow {
  vertical-align: middle;
  content: "";
  border-right: 50px solid transparent;
  border-left: 50px solid transparent;
  border-top: 75px solid #222;
  width: 0;
  height: 0;
}

HTML:

<div class="arrow"></div>

enter image description here

(Firefox renders the one on the left)

like image 439
Wordpressor Avatar asked Mar 21 '14 12:03

Wordpressor


1 Answers

Seems like firefox still has problems with the jagged lines.

Workaround:
I came accross this workaround: Example maybe it helps you out - no guarantee.

Alternative I:
Make all borders the same size (in your example e.g. 50px) then you will not see the jagged lines. You can scale the size of the arrow with the border-size.

Alternative II:
Use an image (should not be a huge request / load time ...)


EDIT:

Got it work!: jsfiddle
The trick was to add this line of code: border-style: solid dotted none;

EDIT 2020:
The hacky workaround is not needed anymore. Updated fiddle.

like image 85
F. Müller Avatar answered Nov 15 '22 02:11

F. Müller