我在网页上有一个HTML按钮,文本在悬停时变为粗体。但是,当发生这种情况时,按钮变大,我不想发生这种情况。因此,我使用了一些简单的JavaScript来使按钮在document.ready上的大小达到150%。但是,我正在尝试最小化JS的使用,那么仅在CSS中这是可能的吗?
代码示例:
<button id="b1">Test</button>
<style>
<!-- When you hover over the button, it resizes - I want the width to become 150% what it would be on page load. -->
#b1{
float: right;
margin-left: 15px;
background-color: white;
height: 100%;
transition-duration: 0.2s;
font-weight: bold;
border: 0;
font-size: 20px;
outline: 0;
}
#b1:hover{
color: #33F;
font-size: 22px;
}
</style>
提前致谢,
- 马修
答案 0 :(得分:2)
This might be the Problem :
<button class="btn1">Hello</button>
<br><br><br><br>
Solution - need to add min-width or width in button
<button class="btn2">Hello</button>
&#13;
rm $HOME/Library/Preferences/com.google.SymbolUpload*
&#13;