I'm looking for the best solution out there for round corners on boxes, which have to work in all browsers (including IE 7-9)
I've been looking on CSS3 PIE, which seemed promising until I saw the list of "Known Issues". Relative paths and z-index problems made me look for other solutions. I noticed they have a "JS Solution" for CSS3 PIE as well, but this has some big disadvantages as well..
Are there any other good solutions out there for round corners crossbrowser-wise?
There is NO pure CSS solution for all browsers, you will have to create this using images, either using a Javascript solution or CSS code that includes the rounded images.
Blame IE7-9 for the non CSS3 solutions...
here you have a guide to create round borders for all browsers
http://jonraasch.com/blog/css-rounded-corners-in-all-browsers
The best i can suggest is
border-radius: 5px;
I know it doesn't work in all browsers, but it's a CSS3 feature, so sooner or later it will work in all browsers.
here you can see it works for all major browsers
http://www.deepbluesky.com/blog/-/browser-support-for-css3-and-html5_72/
and it works in IE9 too
It's not exactly the answer you're looking for (honestly, if you really want IE7-8 support, CSSPIE is pretty decent).
I've been using prefix-free on my sites as of late so I don't have to worry about vendor support. Just use what CSS3 you want and the js takes care of adding all the pre-fixes where necessary. If/when vendors all support CSS3 properties, just remove the JS file instead of combing through your css and removing all the prefixed parts.
Since you have incuded IE7 above, so I would say there is no pure CSS solution to acheive this. Modern browsers support border-radius to achieve rounded corners and you need to specify the -moz and -webkit for mozilla and webkit based browsers.
To achieve rounded corners, I would suggest you put all your rounded cornners in one image and make an sprite of this. then use background-position to get it working across all the range of browsers out there, including our good old friend IE6.
As of this writing, I don't think that there are any other "good" solutions for cross-browser rounded corners. I have searched high and low and CSSPIE is the best solution I have found. The "known issues" are not nearly as bad as the alternative of having crummy looking pages in IE or resorting to images for everything.
The path issues you are experiencing probably have to do with the fact that the PIE.htc path is relative to the document you are viewing, and not the CSS file that calls it. Just be sure to check that and you should be in good shape.
z-index issues are probably related to children of a PIE border-radius parent not having a -pie-watch-ancestors value set. Alternately, you could just call the PIE behavior again separately on the children.
CSS3PIE takes a little getting used to, particularly if you are trying to get it working with .less files, or on shived html5 elements, or if you're running IE in Parallels on a Mac. There are a lot of things that can go wrong in these scenarios. I honestly believe, though, that PIE is your best bet. If at first you don't succeed, don't give up. You CAN get border-radius working in older versions of IE, along with other essential enhancements like gradients, box-shadows and the like.
I believe the link below works in most browsers and that Facebook did something like this for a week to add a rounded style to their site, and then they realized it takes awhile to load up the corners for IE people.
http://jquery.malsup.com/corner/
Related
I work for a client who has masses of <a> elements on their site which use the same styling and reference the same class name.
The problem I have is the developer who worked on this project before me used CSS3 to style the element and completely ignored the fact IE7 and IE8, even though it was in the scope of the browser model and this issue is now apparent on hundreds of pages.
What I want to ask is what do you feel the best approach is to putting a suitable fix in place without effecting the markup? such as scripts which support border-radius, box-shadow, gradients etc.
Please don't come back answering about graceful degradation as this is not going to happen, I have already spoken to the client and they don't want to take that approach.
You can use a script to perform that "support" for you on clients using old IE versions!
Download script here.
This script allows CSS3 support for Internet Explorer 6, 7, and 8.
The web site link!
My favourite solution to this problem is CSS3 PIE. It's an HTC which brings
a nice selection of CSS3 features to IE 6-9.
Note: PIE uses absolutely positioned VML elements (in IE6-8) to support a variety of CSS3 features. This can cause issues like disappearing backgrounds/borders/etc. The fix is usually to use position: relative; on the affected element or it's parent. See the known-issues for more information (and other fixes).
I think there is no one solution but you can combine more than one solution, for example to border-radius you can use jquery corner:
http://jquery.malsup.com/corner/
modernizr can be a good tool too!
In my website, it looks great on any browser but Internet Explorer. I know that older versions Internet Explorer doesn't support CSS3, so I was wondering if there were equivalents in HTML to these methods: max-width:, border-radius:, box-shadow:, and transition:.
Any help would be appreciated.
For border-radius and box-shadow there is http://css3pie.com/ but that requires Javascript in IE. For a HTML only solution you have to use images, i guess.
You are asking for a way to get some of the newer features of CSS rendered in a browser that doesn't support CSS (or let's hope you are ignoring browsers that old and instead working with a browser version that do some CSS, but not enough for your tastes). Those browsers are outdated and you are not going to get it work just by avoiding css.
If you go far enough back, you may actually end up at a point in time when there were things that were possible in html weren't in css. However, it has been quite a while now that CSS is your best shot at getting things like that to work. If it doesn't work, it usually means that the browser doesn't support it at all, not that it doesn't support it through CSS.
Of course, you can work some magic and try to fake things with javascript, but it just isn't the same.
I recommend using modernizr. It detects if a browser supports different css3 (and html5) features and, if it doesn't, you can conditionally load javascript as a fallback solution.
Internet Explorer 9 supports max-width, border-radius and box-shadow, but not transition.
Personally I don't think CSS should have transition (or animation) as styles should affect how content is displayed, not how it behaves (I am also against the behaviour IE extension for this reason).
Overall, these styles you are asking for are aesthetical, and shouldn't really be a major issue if they aren't supported by the browser your user is on.
Are there any methods out there that do not use images to implement rounded box. That also works in all the IE browsers.
Short answer: No.
Long answer: Not for every version of IE. But: why would you bother showing round corners to all browser? Sites like Twitter have just gave up on that: you don't have a good modern browser? You don't get to see my iCandy.
There are several VML and HTC-based hacks out there, including DD_roundies - searching Google for Internet Explorer Rounded Corners CSS or Internet Explorer Border Radius CSS should get you some other results.
Personally, I just allow Internet Explorer to render my pages differently: http://dowebsitesneedtolookexactlythesameineverybrowser.com/
I like to use jQuery corner plugin, if it is using IE, it creates some divs with backgroud, but if it using another browser like Chrome, or Firefox it uses a the native CSS atribute "radius".
Also this plugin can create a lot of interesting effects for your corners.
Take a look, and good luck.
Found this site. Works like a charm.
http://css3pie.com/
You can try this : CurvyCorners
This method does not use images and works everywhere but uses a LOT of code to do it:
http://spruce.flint.umich.edu/~jalarie/jaa_kcm.htm
This may not directly address your specific request, but it is a point worth discussing.
If it's not a do-or-die requirement to have rounded corners in IE, it's actually ok to be comfortable with the fact that you won't have rounded corners for IE users. The benefits you gain with going with CSS3 rounded corners (small code, easy maintainability, tight control) outweigh the potential of an IE user being disappointed he or she didn't get the rounded corners.
I have a site, here, that I'm working on which uses some html5 and css3 elements which obviously do not load correctly on certain browsers and i have a few questions about what I can do and I don't have much experience with any codes like php or javascript. these questions are kind of a mess as well - I've been searching all over not really sure of what I should be looking for.
How would I go about creating a popup based on which browser is being used, if possible?
I understand that I can use conditional comments for IE but IE is not the only unsupported browser. Is there a way to activate certain elements, or div's depending on the browser?
How would I go about creating a version of the site that would be shown instead of the unsupported version?
Is there a better way to do this?
These questions may not be the right ones - if not and you know an answer to the question I'm looking for, please, go for it! Thanks!
There are a few tools I would recommend:
Modernizr
Feature detection, allowing you to target features in CSS and JS. It doesn't add features, just lets you test for them.
Includes HTML5shiv functionality Also does a lot more – if you don't use the other features, then don't use it, it does slow down page loads, but is worth it if you need it!
HTML5shiv
Very small, allows you to use html5 elements in IE, nothing else.
CSS3PIE
Lets you use border-radius, gradients and box shadow in older versions of IE. Also can allow PNGs in IE 6. Adds a noticeable delay to page load.
ie7.js (and ie9.js)
Gives you many CSS3 selectors, min and max width, multiple classes and fixed positioning. Also can have a png fix if you like. Doesn't seem to slow things down much.
You can use the moderizer script to bridge the gap for html markup.
I wouldn't really worry about CSS3 working or not in IE. If you have a supported browser you get an enhanced user experience and if you don't you would just get a normal one.
Hi!
I have notice that some sites are using -moz-border-radius to get round cornors on elements? Is this a good practice? Are there any cons with it?
I would recommend adding "-webkit-border-radius" to cover Safari and Chrome, and "border-radius" to cover the CSS3 standard.
The only problem is IE8 won't support the rounded corners. But it looks nice in all other browsers.
Using border-radius (and it's browser specific friends -moz-border-radius and -webkit-border-radius) is the simplest strategy for getting rounded corners on elements. Because this method is standards compatible (and doesn't need ugly hacks such as positioned elements with backgrounds), it is the best way.
For the differences between -moz and -webkit, see this page at css3.info. This page also contains some more info about it.
Yes, border-radius is considered good practice. It's certainly a lot better than the alternatives such as messy JQuery stuff or worse, a set of corner graphics -- all the alternatives have major issues, ranging from non-scalability to messing up your backgrounds. border-radius is pure CSS and has none of these issues.
The only reason you wouldn't use it is lack of support in web browsers. However all the major browsers except IE now support border-radius. Some do still need a vendor prefix like -moz-, so you need to specify it several times but the functionality is basically the same across all browsers.
The one browser that doesn't support it is IE, up to version 8 (IE9 will support it, but isn't released yet). The good news is that there is a very nice little hack for IE that adds support for border-radius (and a few other features too), even to older versions like IE6.
The hack is called CSS3Pie, and is well worth taking a look at if you want to use this feature. It means you can use a modern CSS3 feature like border-radius without having to stress too much about your IE users.
Philosophically
The CSS property for border-radius is one of the best ways to achieve rounded corners anywhere on a website. IMO it is THE BEST way.
Although border-radius is not supported on across all browers/versions, I like to stick with using this property for almost all instances where rounded-corners are beneficial because rounded-corners are a decorative feature, so therefore not essential in instances where it is not supported, and also typically not worth the extra bandwidth of using an image based effect, or even a javascript hack like CSS3Pie.
This follows the "progressive-enhancement" rationale of web design. Users that have a modern browser supporting border-radius get to see them, other users don't. But a border radius is typically not an issue of accessibility or usability, so therefore implementing via CSS is the best route to go 95% of the time.
Practically
In practice using border-radius requires actually three properties to be supported across the majority of modern browsers:
div {
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
The first, border-radius is the actual property listed in the CSS3 spec, and one day will be the defacto implemented rule. But until widespread adoption is achieved and the spec is finalized, you still need to include the vendor-specific prefixes for -moz- (Mozilla Firefox) and -webkit- (Google Chrome and Apple Safari browsers).
Resources
http://border-radius.com/
Generates the proper rules / shorthand versions depending on what values you wish to apply and which corners you wish to round. Very handy.
http://www.css3.info/preview/rounded-border/
Some additional info about vendor support, how to use the shorthand, etc.