instead of
gpt4 book ai didi

按钮的 CSS 样式 : Using <input type="button> instead of

转载 作者:技术小花猫 更新时间:2023-10-29 10:06:37 26 4
gpt4 key购买 nike

我正在尝试使用 <input type="button"> 设置按钮样式而不仅仅是 <button> .使用我的代码,按钮一直延伸到整个屏幕。我只想让它适合按钮中的文本。有什么想法吗?

参见 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,0,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,255,0.5);
-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.5);
box-shadow:inset 0 1px 0 rgba(255,255,255,0.5);
cursor:pointer;
}
.button:hover {
background-color:rgba(255,204,0,0.8);
}
</style>
<body>
<div class="button">
<input type="button" value="TELL ME MORE" onClick="document.location.reload(true)">
</div>
</body>

最佳答案

你真的想为 <div> 设置样式吗? ?或者你想为 <input type="button"> 设置样式吗? ?如果你想要后者,你应该使用正确的选择器:

input[type=button] {
color:#08233e;
font:2.4em Futura, ‘Century Gothic’, AppleGothic, sans-serif;
font-size:70%;
/* ... other rules ... */
cursor:pointer;
}

input[type=button]:hover {
background-color:rgba(255,204,0,0.8);
}

另见:

关于按钮的 CSS 样式 : Using &lt;input type="button> instead of <button>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11053516/

26 4 0
技术小花猫
个人简介

我是一名优秀的程序员,十分优秀!

滴滴打车优惠券免费领取
滴滴打车优惠券
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com