10

I'm using the CSS3Pie htc file to enable border-radius in IE8, but I'm getting no effect. My CSS is:

button {
    border-radius: 4px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    behavior: url(PIE.htc);
}

I've put PIE.htc in the public root (as is done on the CSS3PIE demo page), having tried in the same folder, using a relative uri and an absolute uri.

The demos are working; just not my code!

Thanks, Adam

Caspar Kleijne
  • 21,552
  • 13
  • 72
  • 102
Adam Hopkinson
  • 28,281
  • 7
  • 65
  • 99

6 Answers6

29

Try adding

position:relative;
z-index: 0;

as suggested here http://css3pie.com/forum/viewtopic.php?f=3&t=10

This question is similar to the one posted here:

CSS3 PIE - Giving IE border-radius support not working?

Community
  • 1
  • 1
Daniel Rehner
  • 1,771
  • 12
  • 8
4

The URL of PIE.htc as referenced in behavior: url(PIE.htc); is a relative URL, so it is probably looking for it in the same directory as the stylesheet, so I'd suggest adding a slash to make it an absolute URL. But you say you've already done that.

Check that the URL you're specifying does actually load the PIE.htc file - ie put that URL directly into your browswer and see what comes out. It is possible that your web server is not serving it correctly for one reason or another (not recognising the mime type? etc)

Have you gone through the known problems on the PIE site? Have you added position:relative; to your style? Could it be the known z-index issue?

You specify that it doesn't work in IE8. Have you tried it in IE7? IE6? Same result? (this will eliminate ths possibility of it being an IE8-specific issue)

By the way -- unrelated point, but you should put the border-radius style below the versions with the browser-specific prefixes. This is the standard way to do things, as it means that when for example, Firefox starts supporting border-radius, it'll pick up the standard style over -moz-border-radius. If you've got the -moz version below it, that one will continue getting used, which may not be what you want.

Spudley
  • 166,037
  • 39
  • 233
  • 307
  • Actually the URL is relative to the URL that is being viewed in the browser, not CSS. Some IE weirdness. But for me, it mattered whether it was in a subdirectory called `pie` or right next to the main file, i.e. `url(PIE.htc)` worked, `url(pie/PIE.htc)` didn't. – Erik Kaplun Oct 26 '11 at 17:33
3

As Daniel Rehner stated, you need to use the position: relative and z-index properties for IE8. If you are using a website with sub directories to call the CSS file, you will also need to use an absolute path in your CSS to PIE.htc - this was one part of our issue.

The other part of the issue could be that your server is not outputting the PIE.htc file as text/x-component. You can correct that via IIS or Apache, or call the PIE.php script in your CSS. More info here: http://css3pie.com/documentation/known-issues/#content-type

Both of these issues had gotten us, and hope they help you out.

bandrzej
  • 533
  • 1
  • 5
  • 14
2

I actually had this problem for a completely different reason.

The border-radius will not work if a filter is applied to the same element. I was applying the border-radius to a button with a linear gradient applied as a filter. As soon as I removed the filter the border-radius worked.

This is documented behaviour and gradients should be applied using -pie-background:

http://css3pie.com/documentation/supported-css3-features/#gradients

Linus Norton
  • 557
  • 1
  • 4
  • 15
1

Just in case anyone is trying to apply this to table cells, you'll need to apply position: relative to the table element (and not the tdor th, even though those are the elements being rounded).

james6848
  • 1,657
  • 3
  • 25
  • 39
1
behavior: url(PIE.htc);

Make sure there is no space between the url and ( as this stopts it from working at all in IE8

JackSD
  • 197
  • 10