【发布时间】:2017-08-02 22:52:01
【问题描述】:
我是编码新手,我正在做一些小事。当我点击这个按钮时,我试图让页面的背景发生变化。由于我是编码新手,因此我不知道使用此方法的正确方法。任何建议都会有所帮助。到目前为止,这是我在 html 和 css 中所拥有的。
<div class="wrapper>
<p>Click on the button to see the magic happen!</p>
<input class="button" type="button" value="Click Me">
然后在 CSS 中我有以下内容:
.wrapper{
text-align: center;
}
.button{
display: inline-block;
padding: 15px 25px;
font-size: 24px;
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #fff;
background-color: #EE835A;
border: none;
border-radius: 15px;
box-shadow: 0 9px #999;
}
.button:hover {background-color: #EE8354A}
.button:active {
background-color: #4A6273;
box-shadow: 0 5px #F68B8B;
transform: translateY(4px);
}
【问题讨论】:
-
几小时前我刚刚回答了一个类似的问题。你可能想看看here。
标签: javascript html button