所有这些都可以在CSS 3中完成,但我不会推荐它。如果您希望它在所有浏览器中看起来都一样,那么使用按钮和标题的图像是最好的办法。如果你想这样做的CSS反正试试这个:
HTML:
<header>
<div class="shadow"></div>
<h1>Taffies Cupcakes</h1>
<h2><div class="line"></div>Fresh and tasty<div class="line"></div></h2>
</header>
CSS:
header > .shadow {
width: 0px;
height: 0px;
margin: 0px 50%;
box-shadow: 0px 0px 200px 100px white;
}
header h2 > .line {
height: 1px;
width: 100px;
margin: 5px 20px;
background-color: #846a5f;
display: inline-block;
vertical-align: middle;
}
至于其他的答案也提到,radial-gradient
可能是去这里的路。只要将它应用到header
元素上,而不是使用我的版本和box-shadow(对某些人来说可能有些不好意思)。
更新按钮:
HTML:
<button class="special"><div class="icon"></div><div class="headline">ORDER NOW</div><div class="description">We deliver in 24 hours</div></button>
CSS:
button.special {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #784f3d), color-stop(1, #846a5f));
background:-moz-linear-gradient(center top, #784f3d 5%, #846a5f 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#784f3d', endColorstr='#846a5f');
background-color:#784f3d;
color: #e7d2c9;
text-align: left;
border: 0;
outline: 0;
border-radius: 5px;
height: 42px;
}
button.special > .icon {
width: 27px;
height: 27px;
/*background-image: url('triangle-button.png')*/
position: absolute;
margin: 5px;
}
button.special > .headline {
margin-left: 42px;
font-size: 18px;
}
button.special > .description {
margin-left: 42px;
font-size: 12px;
}
http://jsfiddle.net/ezdr3xdg/17/
按照您的问题顺序:使用CSS渐变/是/是/使用图像作为img src或背景。现在你已经足够了解并告诉我们你是如何做到的 – Devin 2014-09-05 21:07:58