How to add CSS3 rounded corners with modernizr? - css

I am trying to add CSS3 based rounded corner support in IE7 and IE8 on following page
Test URL: http://jaspreetkaur.com/postjoint
I have included modernizr library, but it's not working. Is there any code that i need add to make it working in IE?

As others have said, Modernizr won't make legacy browsers able to support CSS3. It only checks for support, plus other neat features, such as HTML5shiv, so that you can use HTML5 markup.
To enable CSS3 features in older browsers, you might try CSS3 Pie, but I find it some times creates more problems than it solves. I usually just don't let older browsers see all the fancy stuff, such as rounded corners. It's just a minor design feature, not critical to the overall functionality or layout.
http://css3pie.com/

Modernizr only check if the browser is ABLE to support certain features, it will not actually implement the features

1. IE8, IE7 do not support CSS3 rounder corners.
2. Mordernizr, is only a script, that enable HTML5 features across different browsers
CSS3 tag for rounder corner is
-webkit-border-radius: 5px; /* for safari */
-moz-border-raidus: 5px; /* for firefox < 4 */
border-radius: 5px; /* for all other that support it */

modernizr isn't made to do that really...
if you can, try this http://fetchak.com/ie-css3/

Related

How to create rounded corner buttons in ie 8 [duplicate]

Does anyone know if/when Internet Explorer will support the "border-radius" CSS attribute?
Yes! When IE9 is released in Jan 2011.
Let's say you want an even 15px on all four sides:
.myclass {
border-style: solid;
border-width: 2px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
}
IE9 will use the default border-radius, so just make sure you include that in all your styles calling a border radius. Then your site will be ready for IE9.
-moz-border-radius is for Firefox, -webkit-border-radius is for Safari and Chrome.
Furthermore: don't forget to declare your IE coding is ie9:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
Some lazy developers have <meta http-equiv="X-UA-Compatible" content="IE=7" />. If that tag exists, border-radius will never work in IE.
The answer to this question has changed since it was asked a year ago. (This question is currently one of the top results for Googling "border-radius ie".)
IE9 will support border-radius.
There is a platform preview available which supports border-radius. You will need Windows Vista or Windows 7 to run the preview (and IE9 when it is released).
While you're waiting.. Curved corner (border-radius) cross browser
A workaround and a handy tool:
CSS3Pie uses .htc files and the behavior property to implement CSS3 into IE 6 - 8.
Modernizr is a bit of javascript that will put classes on your html element, allowing you to serve different style definitions to different browsers based on their capabilities.
Obviously, these both add more overhead, but with IE9 due to only run on Vista/7 we might be stuck for quite awhile. As of August 2010 Windows XP still accounts for 48% of web client OSes.
It is not planned for IE8. See the CSS Compatibility page.
Beyond that no plans have been released. Rumors exist that IE8 will be the last version for Windows XP
<!DOCTYPE html> without this tag border-radius doesn't works in IE9, no need of meta tags.
Quick update to this question, IE9 will support border-radius according to: http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx
Use -ms-border-radius: 15px, any element that uses css -ms- is compatible with IE.
The corner radius issue of IE gonna solve.
http://kbala.com/ie-9-supports-corner-radius/
What about support for border radius AND background gradient. Yes IE9 is to support them both seperately but if you mix the two the gradient bleeds out of the rounded corner. Below is a link to a poor example but i have seen it in my own testing as well. Should of taken a screen shot :(
Maybe the real question is when will IE support CSS standards without MS-FILTER proprietary hacks.
http://frugalcoder.us/post/2010/09/15/ie9-corner-plus-gradient-fail.aspx
SOLVED - not rendering border radius correctly in IE 10 and 11
For those not getting the
-ms-border-radius: or the border-radius: to work in IE 10,11
And it renders all square then follow these steps:
Click on the gear wheel at the top right of the IE browser
Click on Compatibility view settings
Now uncheck the 2 boxes that are checked by default.

Should I still use vendor prefixes for border-radius?

Currently, when I code I use:
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
But based on my tests, it didn't make any difference with any modern browser ( Chrome 33+, opera 25+, safari 8+). Internet Explorer 8 doesn't supports this property, but the vendor prefixes won't make any difference.
Is there any reason to keep them?
Use http://caniuse.com/#search=border-radius for checking such
Conclusion: No need for adding vendor prefixes for border-radius, as its supported in all major browsers (and IE9+). If you really need border-radius in IE8 check out: How to apply border radius in IE8 and below IE8 browsers?
But in 99% of cases border-radius is not crucial to a design. Employ the technique of graceful degradation and leave IE8 with square corners
You can also add PrefixFree to your page to cover you in a few more cases than just border-radius, as it will add these prefixes for you to be safer.
And for backwards compatibility using CSS3 with older versions of IE there is PIE (again not just for border-radius but others) and you can just add this where you need it:
behavior:url('pie.htc');

CSS3 border-image

Do I need some special DOCTYPE when I want to use CSS3 ? I have div with dashed border and I want to set border-image (only can with CSS3), but when I set border-image:url(.., nothing happens.
Some browsers may only support CSS 3 features in Standards Mode, but a standards mode triggering Doctype should be considered business as usual and not "special".
Keep in mind that CSS 3 is a collection of specifications that have not yet reached recommendation stage. They are very new and browser support is far from universal (and isn't a binary state of 'supports CSS 3 or not' — the current versions of all the major web browsers support some of CSS 3 (for different values of 'some'). Your problem could simply be that you aren't using a browser that supports border-image.
border-image currently works in Safari
and Firefox 3.1 (Alpha). The syntax to
use it is:
border-image: url(border.png) 27 27 27
27 round round;
See demonstration page
CSS3 is not available on all browsers at this time. Right now, only Chrome, Opera, and Safari support it. CSS3 commands will not work on IE; you'll have to find other work-arounds or wait until browsers catch up with the standards.
Most likely the border-image did not show up, because you didn't use the correct prefixes.
Right now, just "border-image" is not supported by major browsers, hence you need to add the prefix for the browser.
E.g.
-webkit-border-image
-moz-border-image
-o-border-image
-webkit - for WebKit-based browsers such as Google Chrome and Safari
-moz - for Firefox
-o - for Opera
You do not need a specific DOCTYPE, but border-image is only supported in some browsers. You can also use:
-webkit-border-image
-moz-border-image
-khtml-border-image
-o-border-image
to broaden the range of support for browsers. CSS3 has not been implemented as a standard across all current browsers, so using specific CSS tags is the best way to go for now.
Support is very limited and inconsistent across the browsers that do support it. Check Quirksmode (bottom of the table) to see the bad news http://www.quirksmode.org/css/background.html

Does IE have anything similar to what -moz-border-radius does in firefox/chrome?

Does IE have anything similar to what -moz-border-radius does in firefox/chrome?
Also is the -moz-border-radius supported by safari?
IE doesn't support the border radius CSS3 or custom implementations. Your best bet is to use something like jQuery and a rounded corners plug in (see below) to accomplish it.
http://plugins.jquery.com/project/corners
Here's a 2nd plug in that I use more often than the above:
http://www.methvin.com/jquery/jq-corner-demo.html
EDIT:
As for safari, yes it has a custom implementation like mozilla.
-moz-border-radius: 5px; /* mozilla */
-webkit-border-radius: 5px; /* safari */
I tried corners last week, and it was broken in a number of browsers, most notably IE8. I'd avoid if possible.
You should design your design so that it looks and works ok in IE, and if opened in one of the newer browsers little things like rounded corners would just make your site look that much better. Things like that will eventually cause users to move to newer browsers, when the experience is better in one and not the other.

How handle the CSS3 Spec. in a useful way?

The CSS3 Specifications are in the main browsers partly implemented and you get very nice results with less code, but there are many reasons not to use CSS3. E.g. not downwardly compatible, probably not similar renderd views on different browsers, etc.
So I'm asking myself: Which is the best way to use CSS3 anyway with a option to intercept default problems, like I've discribed above?
As long as your site degrades gracefully there's nothing wrong with using CSS3 now. Afterall, if a browser does not understand a particular CSS rule it will just ignore it:
#foo {
border:1px solid #000; /* shown by all browsers */
border-radius:5px; /* shown if browser understands border-radius */
-moz-border-radius:5px; /* Firefox only */
-webkit-border-radius:5px; /* Safari and Google Chrome */
}
As long as the site does not look broken in browsers that don't support the CSS3 rules you want to use then you should be ok progressively enhancing your site in the browsers that do support them.
You might find "When can I use..." useful for seeing what features you can reasonably use.
If your making a public website then you have to support ie6, which means no css 2.1, let alone 3.
One thing you can try is: lesscss
This will let you use shorthand css notation and "compile" it to valid css on build.

Resources