7

That's a standard CSS for a CSS triangle:

display: inline-block;
vertical-align: middle;
content: " ";
border-right: 4px solid transparent;
border-left: 4px solid transparent;
border-top: 6px solid black;
width: 0;
height: 0;

http://jsfiddle.net/d6w2e/

It works well, but it renders with pixelated edges in Firefox under OSX.

Luckily there's an easy for Firefox! So let's just apply border-style:

border-style: solid dotted none;

So far so good, the problem is when you set border-style it TOTALLY breaks (renders a rectangle) in IE10+ (but works in IE8, which is crazy!):

enter image description here

Here's a blog post on it (try opening it in IE11, although you have screen above):

http://blog.dustinboersma.com/post/45768836072/fixing-osx-firefox-border-triangle-pixelation

Any ideas how to make in work in Firefox AND IE10?

3
  • try to add specific browser classes and style it like: .gecko .arrow-down {border-style: solid dotted none;} Commented May 22, 2014 at 8:02
  • could you clarify witch browsers by listing the ones you are targetting. Commented May 22, 2014 at 8:24
  • If any of the answers are acceptable, please consider choosing one and marking it as the accepted answer. Commented Jun 4, 2014 at 10:58

2 Answers 2

3

Use double instead of dotted.

See http://jsfiddle.net/d6w2e/4/

I'm not aware of the precise reason why dotted doesn't work for IE10+, but it is probably to do with the way the line needs to be calculated because of the gaps.

We must remember that the CSS triangle is a useful but hacky and unintended way of exploiting the way web browsers intersect borders.

.arrow-down {
  position: absolute;
  top: 22px;
  left: 10px;
  display: inline-block;
  vertical-align: middle;
  content: " ";
  border-right: 32px double transparent;
  border-left: 32px double transparent;
  border-top: 48px solid black;
  width: 0;
  height: 0;
}
Sign up to request clarification or add additional context in comments.

Comments

-1

Keep border-style: solid, then add -moz-border-start-style: dotted; so that on Firefox it renders smoothly.

Here's a demo

CSS:

.arrow-down { 
  width: 0; 
  height: 0; 
  border-width: 20px 20px 0;
  border-style: solid;
  -moz-border-start-style: dotted;
  border-color: #f00 transparent;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.