CSS Rounded Table Corners, Gradient Background

社会主义新天地 提交于 2020-03-26 07:19:37

问题


Here's me fiddle:

http://jsfiddle.net/6yU6N/10/

I want to work some CSS magic on the table header:

  • Rounded corners in upper left and upper right
  • Gradient color background
  • Gradient border
  • Cross-browser compatibility

How can this all be done?


回答1:


Gradients: Most modern browsers have implemented these using CSS3 but for Internet Explorer you'll have to use special filters. Since CSS3 is an emerging standard, you have to use browser specific prefixes.

.gradient{
    background: -moz-linear-gradient(top, #fff, #eee);
    background: -webkit-linear-gradient(top, #fff, #eee);
    background: -o-linear-gradient(top, #fff,#eee);
    background: linear-gradient(top, #fff, #eee);
    /* versions of IE use these */
    filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#ffffff',EndColorStr='#eeeeee');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#eeeeee)";
}

there may be a third approach keep in mind that you could always use an image with a repeat-x on the background.

Rounded Corners: Rounded corners are covered by border-radius in most of your modern browsers:

border-radius:5px 5px 0px 0px;

For older versions of Internet Explorer, you'll unfortunately have to do more hackerly things that are probably not worth the time and effort really. http://webdesign.about.com/od/css/a/aa072406.htm is an example I found scanning the web really quickly.

For more stuff, the MDC is usually pretty good in my experience about explaining browser features and their compatibility and alternatives for the other browsers.



来源:https://stackoverflow.com/questions/5973179/css-rounded-table-corners-gradient-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!