how to create a container with rounded corner using css1? [closed]
I want to create a container which will have rounded corner without using images(only using border and div tags).
And it should work with all the browsers.
CSS Rounded corners is not compatible with "all browsers", there are too many versions and many older browsers still in use for there to be a pure CSS solution.
Also you are severely limited if you state that you cannot use images, because that's one of the workarounds.
However, I think you should consider using CSS rounded borders because you can degrade gracefully on browsers that do not support them, with other CSS techniques to make the elements look just as good. This is pretty much how most people are doing it these days.
What this means in practice is that when your users upgrade their browsers they "automatically" get the benefit without you having to write two versions of your site.
What browsers do you want to support (does "all browsers" include IE6? What about IE5? earlier than that?).
You presumably know about the CSS border-radius
property. This is the standard way to draw rounded corners on your boxes.
Since you're fussing about "all the browsers", I'll assume you're worried about older versions of IE, and you're right: border-radius
doesn't work in IE6, IE7 or IE8.
If you don't want to use images, but you do want to support these browsers, then you're going to have to use a Javascript-based solution.
By far the best and easiest to use is CSS3Pie. It hooks into the stylesheet, using IE's behavior
style, and makes IE work with the standard border-radius
style. See the instructions and demos on the CSS3Pie website for more info on how it works, but suffice to say it's the only solution I'd recommend these days for rounded corners in IE.
精彩评论