twitter-bootstrap 如何将输入的样式切换为看起来像标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18286357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can i toggle an input's style to look like a label
提问by Tim
Ive got some input fields which i want to style to initially look like labels, and then via angular.js apply a style to them so they can be edited after button is pressed. I'm using bootstrap, is there a inbuilt class i can toggle on and off these inputs?
我有一些输入字段,我想将其样式设置为最初看起来像标签,然后通过 angular.js 对它们应用样式,以便在按下按钮后可以对其进行编辑。我正在使用引导程序,是否有可以打开和关闭这些输入的内置类?
回答by Marcin
<style type="text/css">.asd {
background: rgba(0, 0, 0, 0);
border: none;
}
</style>
<input type="text" class="asd" value="Label look like" disabled/>
回答by Bob Vork
Not as easy as toggling a class, but you could use a <p>with the .form-control-staticclass for a label, and a normal input field. Then switch visibility on those for editing.
不像切换一个类那么容易,但是您可以使用<p>带有.form-control-static标签的类和一个普通的输入字段。然后切换可见性以进行编辑。

