views:

880

answers:

3

I am in the process of dicing and slicing a psd layout from a designer. The design is based on the 960 grid system and consists of multiple boxes (a 960px box for the top menu, 2 460px boxes for the 2 content areas, a 220pixel and a 720 pixel for another content setup option etc). All these boxes are based on a solid background color (body) but they all have rounded corners and a aprox border of 10pixel all the way around which are gradient.

I am contemplating on what would be the best route to take here, html wise, while keeping in mind that it should ofcourse validate, nice semantics etc.

Any ideas/input?

+3  A: 

I am contemplating on what would be the best route to take here, html wise, while keeping in mind that it should ofcourse validate, nice semantics etc.

The best route to take here would be using pure CSS3 to add the rounded corners and gradients.

Benefits:

  • No additional, semantically meaningless, crappy markup required
  • No images required
  • Easy to implement and maintain
  • Ability to degrade gracefully for older browsers that don’t support CSS3

Downsides:

  • Doesn’t work in every browser yet

It’s really up to you.

If you want your site to look exactly the same in every browser, CSS3 is not an option — you’ll have to rely on hard-to-maintain images and bloated markup.

However, if you don’t mind giving users of older browsers a slightly different but still nice design, CSS3 definitely is the way to go.


‘CSS3’ gradients:

CSS3 rounded corners:

Mathias Bynens
It needs to be fully compliant with IE+,7 and 8 + FF, Chromse and Safari - so CSS3 is not an option im afraid :(I was think about maybe using some jQuery, but not sure about the load effect (the square corners when the page is rendering, and then a short falsh and then the corners are round when loading is complete)
cJockey
Firefox, Chrome and Safari will display the rounded corners, Opera and IE7,8 will just ignore that rule and display square boxes. For things like rounded corners I'm willing to take that trade-off. It's impossible to make your site look pixel perfect on all browsers.
ZippyV
I would go with this approach while sniffing out IE and using JavaScript to provide the rounded corners for IE users. Maybe this one - http://www.methvin.com/jquery/jq-corner-demo.html
Scott Radcliff
A: 

I recommend trying javascript library DD_roundies (http://www.dillerdesign.com/experiment/DD_roundies/). Most browsers already support rounded corners as specified in CSS3, and DD_roundies adds the support also for browsers that don't (like IE).

JussiR
A: 

This ain't going to work flawlessly in all webbrowsers from IE6 and up with only CSS. You'll need to grab JavaScript to get it to work in all browsers. There are jQuery plugins which can round corners on the fly, working on all webbrowsers, without any additional images or CSS. I've had good experiences with this jQuery Corner plugin.

BalusC