我正在尝试使用<input type="button">
而不是仅使用按钮设置样式<button>
.使用我的代码,按钮一直延伸到整个屏幕.我只是希望能够使它适合按钮中的文本.有任何想法吗?
请参阅jsFiddle示例或继续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> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试学习python,并试图创建一个简单的公式,将里程转换为公里并返回一些带有转换的文本.
这就是我所拥有的:
def mile(x):
z = x * 1.609344
print "%.2f" % z
x = float(raw_input("How many miles are you traveling? "))
z = mile(x)
print "That's about % kilometers." % z
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么这不起作用?我绝对可以设置里程功能来打印转换句子,但我不想这样做.
有没有办法在python中考虑大写和小写字母?这是一个例子:
if 'jay' in rapper:
print 'blah blah blah'
Run Code Online (Sandbox Code Playgroud)
我希望Jay或jay的if语句是真的.
我能做什么?
我正在用Python学习基本的布尔逻辑.我理解了相等的运算符,但是当ands和ors被抛入时会感到困惑.例如,看看下面的代码:
people = 20
cats = 30
dogs = 15
if people < cats:
print "too many cats! the world is doomed!"
if people == cats or dogs == cats:
print "this is too hard"
Run Code Online (Sandbox Code Playgroud)
我理解第一个if语句以及它打印的原因.我不知道如何评估第二个if语句.我怎么能改变它来打印那条线?
谢谢你的帮助!