I have some buttons on my pure HTML/JS page. When the page is opened in browser, the button size is normal. But on refresh/reloading page, the button size is reduced. In fact, I have not set the button text value. The button's text is blank. How should I set the size of my button in HTML irrespective to the size of the text?
我的纯HTML / JS页面上有一些按钮。在浏览器中打开页面时,按钮大小正常。但是在刷新/重新加载页面上,按钮大小会减小。实际上,我没有设置按钮文本值。按钮的文本为空白。我应该如何设置HTML中按钮的大小而不考虑文本的大小?
3 个解决方案
#1
#2
5
This cannot be done with pure HTML/JS, you will need CSS
这不能用纯HTML / JS来完成,你需要CSS
CSS:
CSS:
button {
width: 100%;
height: 100%;
}
Substitute 100% with required size
用所需尺寸代替100%
This can be done in many ways
这可以通过多种方式完成
#3
4
button {
width:1000px;
}
or even
甚至
button {
width:1000px !important
}
If thats what you mean
如果这就是你的意思
#1
35
Do you mean something like this?
你的意思是这样的吗?
HTML
HTML
<button class="test"></button>
CSS
CSS
.test{
height:200px;
width:200px;
}
If you want to avoid CSS, see this:
如果你想避免使用CSS,请看:
<button style="height:200px;width:200px"></button>
#2
5
This cannot be done with pure HTML/JS, you will need CSS
这不能用纯HTML / JS来完成,你需要CSS
CSS:
CSS:
button {
width: 100%;
height: 100%;
}
Substitute 100% with required size
用所需尺寸代替100%
This can be done in many ways
这可以通过多种方式完成
#3
4
button {
width:1000px;
}
or even
甚至
button {
width:1000px !important
}
If thats what you mean
如果这就是你的意思