微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

一个按钮的CSS样式:使用而不是

我正在尝试使用< input type =“button”>来设计按钮。而不仅仅是< button&gt ;.使用我的代码,该按钮一直延伸到屏幕上。我只是希望能够适应它在按钮中的文本。有任何想法吗? 看到 jsFiddle Example或继续HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
 <title>WTF</title>
</head>
<style type="text/css">
 .button {
  color:#08233e;
  font:2.4em Futura,‘Century Gothic’,AppleGothic,sans-serif;
  font-size:70%;
  padding:14px;
  background:url(overlay.png) repeat-x center #ffcc00;
  background-color:rgba(255,204,1);
  border:1px solid #ffcc00;
  -moz-border-radius:10px;
  -webkit-border-radius:10px;
  border-radius:10px;
  border-bottom:1px solid #9f9f9f;
  -moz-Box-shadow:inset 0 1px 0 rgba(255,255,0.5);
  -webkit-Box-shadow:inset 0 1px 0 rgba(255,0.5);
  Box-shadow:inset 0 1px 0 rgba(255,0.5);
  cursor:pointer;
 }
 .button:hover {
  background-color:rgba(255,0.8);
 }
</style>
<body>
 <div class="button">
  <input type="button" value="TELL ME MORE" onClick="document.location.reload(true)">
 </div> 
</body>

解决方法

在.button CSS中,尝试显示:inline-block。见这 JSFiddle

原文地址:https://www.jb51.cc/css/219810.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。