【问题标题】:How to make a Button not resizable in a JSP page如何使按钮在 JSP 页面中不可调整大小
【发布时间】:2016-04-09 15:23:32
【问题描述】:

简单的问题:我的 JSP 页面中有这样的按钮

<input type="button" class="MyButton" disabled>

这是 CSS 样式:

.MyButton{

background-color:#44c767;
border:1px solid #18ab29;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:16px;
font-weight:bold;
padding:15px 21px;
text-decoration:none;

}
.MyButton:hover {
 background-color:#5cbf2a;
}
.MyButton:active {
 position:relative; 
}

我希望我的按钮在设置值时不会改变大小,例如:

<input type="button" class="MyButton" value="1" disabled> 

如果我的按钮具有宽度:10px 和高度:10px 的尺寸,我希望它继续具有该尺寸也与 value 参数

我该怎么做?

【问题讨论】:

  • 你能解决这个问题吗?

标签: html css jsp button web-applications


【解决方案1】:

在您的 css 文件中,尝试:

.MyButton {width: 150px}

.MyButton {width: 150px !important;}

【讨论】:

  • 我听从了你的建议,但现在按钮内的文本没有居中。我试图把“文本对齐:中心;”但不起作用,有什么建议吗?
  • 我只是添加宽度:44px;高度:44px; (这些是我的按钮的大小)
  • @Zoythrus,你添加了我上面提到的文本对齐吗?
  • @Zoythrus, Place line-height: 150px;在 .MyButton 块的末尾
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-11-03
  • 2021-09-20
  • 2011-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多