css - 我可以用纯 CSS 制作这种样式吗(按钮)

标签 css

如何在css中获得这种渐变效果?

alt text

最佳答案

您可以使用以下 css 和 html 来实现帖子中的按钮

CSS

#button {
    background-color: #7BCEE6;
    background-image: -moz-linear-gradient(top, #7BCEE6, #3F7DBB); /* FF3.6 */
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #7BCEE6), color-stop(1, #3F7DBB)); /* Saf4+, Chrome */
    background-image: linear-gradient(top, #7BCEE6, #3F7DBB);
 filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#7BCEE6', EndColorStr='#3F7DBB'); /* IE6–IE9 */
    width:120px;
    height:40px;
    -moz-border-radius: 12px; /* FF1+ */
    -webkit-border-radius: 12px; /* Saf3-4 */
    border-radius: 12px; /* Opera 10.5, IE9, Saf5, Chrome */
}
#image {
    width:25px;
    height:40px;
    background:#930;
    margin-left:10px;
    float:left;
}
#text {
    text-shadow: 1px 1px 3px #888; /* FF3.5+, Opera 9+, Saf1+, Chrome */
    color:#fff;
    font-size:22px;
    float:left;
    margin-top:5px;
}

html

<div id="button">
  <div id="image"></div>
  <div id="text">Reports</div>
</div>

实例:http://jsbin.com/ebuno5

注意事项 红色 block 在哪里,应该可以添加 png 图像。此外,您还必须记住,不支持 Internet Explorer 8 下的大多数 css3。要为 ie 添加一些 css3 功能,您可以使用 pie.htc

关于css - 我可以用纯 CSS 制作这种样式吗(按钮),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4630045/

相关文章:

html - 如何将我的 div 放置在一些文本旁边?

html - 按钮和文本距离太远

html - 在 div 中垂直居中列表

当元素到达页面顶部时 jQuery 改变位置

javascript - Bootstrap JS 无法在 Chrome 中运行

html - 在 Ionic 2 中使用 <ion-segment> 时如何显示 <ion-navbar> 的阴影/边框

具有 2 行的 HTML 表格。 1 固定高度,1 100%。比 window 大。为什么?

javascript - 填充功能

javascript - 将 <td> 保存为变量

javascript - 如何显示页面加载html文件直到页面加载完成?