简体   繁体   中英

How to improve the rendering of my HTML/CSS button?

I've achieved nearly the look that a want and I've removed the irrelevant html and I want to improve the look of the button.

在此处输入图片说明

I've created a fiddle for the button.

I think that the color is good (the blue) and the goal is to make the text render and a look that is more clear. How can the text look less blurry and with sharper contrast ? The CSS is

html {
    height: 100%;
    overflow-y: scroll;
}

body {
    background-color: rgb(255, 255, 235);
    font-family: Verdana, sans-serif;
    font-size: 12px;
    line-height: 16px;
    color: rgb(0, 0, 0);
    height: 100%;
    text-align: center;
    background-position: initial initial;
    background-repeat: initial initial;
}


#post {
    display: block;
    position: absolute;
    top: 16px;
    right: 0px;
    height: 46px;
    line-height: 46px;
}

#post a {
    color: rgb(255, 255, 255);
    text-shadow: rgb(255, 244, 210) 1px 1px 2px;
    font-size: 20px;
}

#post a:hover, #post a span:hover {
    text-decoration: none;
}


#ad {
    display: inline-block;
    border: 1px solid rgb(0, 0, 0);
    width: 290px;
    height: 45px;
    font-size: 150%;
    text-decoration: none;
    text-align: center;
    color: rgb(255, 255, 255);
    font-weight: bold;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
    background-image: -webkit-linear-gradient(top, rgb(109, 179, 242) 0%, rgb(84, 163, 238) 50%, rgb(54, 144, 240) 51%, rgb(30, 105, 222) 100%);
    background-position: initial initial;
    background-repeat: initial initial;
}



#post {
    display: inline-block;
    border: 1px solid black;
    width: 290px;
    height: 45px;
    font-size: 150%;
    text-decoration: none;
    text-align: center;
    color: white;
    font-weight: bold;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    background: #6db3f2; /* Old browsers */
    background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6db3f2), color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* IE10+ */
    background: linear-gradient(to bottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0); /* IE6-9 */
}

#post {
    display: block;
    position: absolute;
    top: 16px;
    right: 0;
    height: 46px;
    line-height: 46px;
}

#post span {
    display: block;
    float: left;
    height: 52px;
}

#post a {
    color: #FFF;
    text-shadow: 1px 1px 2px #FFF4D2;
    font-size: 20px;
}

#post a:hover, #post a span:hover {
    text-decoration: none;
}


#ad {
    display: inline-block;
    border: 1px solid #000;
    width: 290px;
    height: 45px;
    font-size: 150%;
    text-decoration: none;
    text-align: center;
    color: #FFF;
    font-weight: 700;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    background: #6db3f2;
    /* Old browsers */
    background: 0;
    /* FF3.6+ */
    background: 0 color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de));
    /* Chrome,Safari4+ */
    background: 0;
    /* Chrome10+,Safari5.1+ */
    background: 0;
    /* Opera 11.10+ */
    background: 0;
    /* IE10+ */
    background: linear-gradient(tobottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%);
    /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0);
    /* IE6-9 */
}

Change the text shadow on #post a (And remove duplicate definitions) eg

#post a {
    color: #FFF;
    text-shadow: 1px 1px 2px #333;
    font-size: 20px;
}

Demo: http://jsfiddle.net/4u4T7/5/

文本阴影使它看起来有点偏离,对文本阴影进行了模拟,如果不确定,则可以使用诸如文本阴影生成器之类的工具来查看实时预览,但我建议使用inspect元素,因为它更好在我看来。

Background

Colorzilla's gradient genetor is very helpful and is browser friendly. though in IE8 and below wont be that High Definition looking.

http://www.colorzilla.com/gradient-editor/

Text

Use text-shadow: 0 2px 0 #f2f2f2;

text-shadow: a, b, c, [d], e;

where a = distance from the text vertically (eg 1px, 2px, 0, -1px)

b = distance from the text horizontally (eg 1px, 2px, 0, -1px)

c = the weight of how it spreads out / smudge out / blur out (eg 1px, 2px, 0, -1px) in your case use 0 because you dont want it blurry looking

d = optional. great use for inner borders

e = color of the shadow

try to read on more of that to understand the syntax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM