3

div: sidebar-top at http://alex.piechowski.org/school/ ...

CSS:

.sidebar-top {
float: left;
height: 32px;
width: 292px;
background: url(../images/sidebar_top.png) no-repeat;
padding: 4px 15px;
}

注意,是图片。没有那个图像可以吗?

4

5 回答 5

1

您可以使用以下规则实现相当相似的效果:

border-top-right-radius: 12px;
border-top-left-radius: 12px;
border: 1px solid #ccc;
width: 290px;
background: -webkit-linear-gradient(top, white 0%,#ddd 100%);
background: linear-gradient(to bottom, white 0%,#ddd 100%);
于 2013-02-23T05:14:59.990 回答
1

我认为这个DEMO是你需要的

.sidebar-top {
background: #ccc;
border: 1px solid rgba(0,0,0,0.5);
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
box-shadow: inset 0 -20px 40px #aaa, inset 0 20px 40px #fff, 0 2px 6px rgba(0,0,0,0.5);
-o-box-shadow: inset 0 -20px 40px #aaa, inset 0 20px 40px #fff, 0 2px 6px rgba(0,0,0,0.5);
-webkit-box-shadow: inset 0 -20px 40px #aaa, inset 0 20px 40px #fff, 0 2px 6px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0 -20px 40px #aaa, inset 0 20px 40px #fff, 0 2px 6px rgba(0,0,0,0.5);
padding: 0px 20px 15px 10px;
width: 500px;
}

h2 {
text-align: center;
font-family: "Helvetica Neue", sans-serif;
color: #444;
text-shadow: 0 1px 1px #fff;
font-size: 14px;
margin: -0 -20px 10px -10px;
padding: 5px 15px;
border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
background: rgba(0,0,0,0.2);
border-bottom: 2px groove rgba(255,255,255,0.75);
box-shadow: inset 0 1px 1px rgba(255,255,255,0.5);
-o-box-shadow: inset 0 1px 1px rgba(255,255,255,0.5);
-webkit-box-shadow: inset 0 1px 1px rgba(255,255,255,0.5);
-moz-box-shadow: inset 0 1px 1px rgba(255,255,255,0.5);
}
于 2013-02-23T05:17:46.020 回答
0
.sidebar-top {
    float: left;
    height: 38px;
    width: 292px;
    -webkit-border-top-left-radius: 15px;
    -webkit-border-top-right-radius: 15px;
    -moz-border-radius-topleft: 15px;
    -moz-border-radius-topright: 15px;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    border:1px solid #D3D3D3;
    background-color:#FBFBFB;
    background-image: -ms-linear-gradient(top, #FBFBFB 0%, #EAEFEF 100%);
    background-image: -moz-linear-gradient(top, #FBFBFB 0%, #EAEFEF 100%);
    background-image: -o-linear-gradient(top, #FBFBFB 0%, #EAEFEF 100%);
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #FBFBFB), color-stop(1, #EAEFEF));
    background-image: -webkit-linear-gradient(top, #FBFBFB 0%, #EAEFEF 100%);
    background-image: linear-gradient(to bottom, #FBFBFB 0%, #EAEFEF 100%);
}

.sidebar-top h2 {
    color: #666666;
    font: bold 16px Arial,Helvetica,sans-serif;
    letter-spacing: -1px;
    margin: 10px;
    padding:0px;
    text-transform: capitalize;
}
于 2013-02-23T05:37:28.440 回答
0

是的,您可以使用下面提到的 css 从这里您可以生成基于 css 的渐变效果 http://www.colorzilla.com/gradient-editor/

.sidebar-top {
   background: rgb(254,255,255); /* Old browsers */
   /* IE9 SVG, needs conditional override of 'filter' to 'none' */
   background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZlZmZmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjM1JSIgc3RvcC1jb2xvcj0iI2Y3ZjdmNyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZWVlZWUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
   background: -moz-linear-gradient(top,  rgba(254,255,255,1) 0%, rgba(247,247,247,1) 35%, rgba(238,238,238,1) 100%); /* FF3.6+ */
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,255,1)), color-stop(35%,rgba(247,247,247,1)), color-stop(100%,rgba(238,238,238,1))); /* Chrome,Safari4+ */
   background: -webkit-linear-gradient(top,  rgba(254,255,255,1) 0%,rgba(247,247,247,1) 35%,rgba(238,238,238,1) 100%); /* Chrome10+,Safari5.1+ */
   background: -o-linear-gradient(top,  rgba(254,255,255,1) 0%,rgba(247,247,247,1) 35%,rgba(238,238,238,1) 100%); /* Opera 11.10+ */
   background: -ms-linear-gradient(top,  rgba(254,255,255,1) 0%,rgba(247,247,247,1) 35%,rgba(238,238,238,1) 100%); /* IE10+ */
   background: linear-gradient(to bottom,  rgba(254,255,255,1) 0%,rgba(247,247,247,1) 35%,rgba(238,238,238,1) 100%); /* W3C */
   border: 1px solid #d3d3d3;
   border-radius: 10px 10px 0 0;
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffff', endColorstr='#eeeeee',GradientType=0 ); /* IE6-8 */
   float: left;
   height: 32px;
   padding: 4px 15px;
   width: 292px;
}
于 2013-02-23T05:39:21.620 回答
0

绝对地。

你需要设置 abackground-color然后你可以做 aborder来获得 1px 边框,它只 border-radius包含顶角,有点像这样:

background-color: grey;
border: 1px solid black;
border-radius: 5px 5px 0 0;

box-shadow要获得渐变,您可以使用设置 ainset来获得所需的渐变,或者按照另一个答案的建议,使用 a linear-gradient

于 2013-02-23T05:16:34.047 回答