gpt4 book ai didi

html - 如何跨越一个按钮?

转载 作者:可可西里 更新时间:2023-11-01 14:47:17 25 4
gpt4 key购买 nike

我想知道这里是否有人可以帮助我?我想要一个带有两个词的按钮,顶部是“Icelandic”,下面是“Toys”。
但我还没有设法做到这一点。

 <p><a href="Icl-Toys.htm" class='button' >Icelandic Toys</a></p><br>

我的CSS:

.button {
border: 2px solid #0a3c59;
background: #f7f9fa;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f7f9fa));
background: -webkit-linear-gradient(top, #ffffff, #f7f9fa);
background: -moz-linear-gradient(top, #ffffff, #f7f9fa);
background: -ms-linear-gradient(top, #ffffff, #f7f9fa);
background: -o-linear-gradient(top, #ffffff, #f7f9fa);
background-image: -ms-linear-gradient(top, #ffffff 0%, #f7f9fa 100%);
padding: 11.5px 23px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
-moz-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
text-shadow: #7ea4bd 0 1px 0;
color: #06426c;
font-size: 15px;
font-family: helvetica, serif;
text-decoration: none;
vertical-align: middle;
}

最佳答案

可以把边框移到P上,设置固定宽度,分界更优雅。

不需要额外的标记或定位。

 .button {
color: #06426c;
font-size: 15px;
font-family: helvetica, serif;
text-decoration: none;
vertical-align: middle;
}

p {
width: 50px;
text-align: center;
border: 2px solid #0a3c59;
background: #f7f9fa;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f7f9fa));
background: -webkit-linear-gradient(top, #ffffff, #f7f9fa);
background: -moz-linear-gradient(top, #ffffff, #f7f9fa);
background: -ms-linear-gradient(top, #ffffff, #f7f9fa);
background: -o-linear-gradient(top, #ffffff, #f7f9fa);
background-image: -ms-linear-gradient(top, #ffffff 0%, #f7f9fa 100%);
padding: 11.5px 23px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
-moz-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
text-shadow: #7ea4bd 0 1px 0;
}

演示: http://jsfiddle.net/k2oostzq/2/

选项 2

如果您不想要固定宽度的按钮,或者它们是动态的,您可以使用 <br>使用此代码标记,并在 p 的内联 block 显示中交换。

html 已添加 br:

  <p><a href="Icl-Toys.htm" class='button'>Icelandic<br>Toys</a></p>

CSS:

 .button {
color: #06426c;
font-size: 15px;
font-family: helvetica, serif;
text-decoration: none;
vertical-align: middle;
}

p {
display: inline-block;
text-align: center;
border: 2px solid #0a3c59;
background: #f7f9fa;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f7f9fa));
background: -webkit-linear-gradient(top, #ffffff, #f7f9fa);
background: -moz-linear-gradient(top, #ffffff, #f7f9fa);
background: -ms-linear-gradient(top, #ffffff, #f7f9fa);
background: -o-linear-gradient(top, #ffffff, #f7f9fa);
background-image: -ms-linear-gradient(top, #ffffff 0%, #f7f9fa 100%);
padding: 11.5px 23px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
-moz-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
text-shadow: #7ea4bd 0 1px 0;
}

演示: http://jsfiddle.net/tL2dc2ov/1/

关于html - 如何跨越一个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27826402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com