Html 如何使用 CSS 更改标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28518594/
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 to change label using CSS?
提问by Isaac Y
I am trying to change the content of an HTML label, but I do not have the capability to edit the HTML. Therefore, I am trying to change the text using CSS. Is there any selector to identify the label below, and if there is, how could I make the text show the word "Organization" instead of "Company"? Thank you.
我正在尝试更改 HTML 标签的内容,但我无法编辑 HTML。因此,我正在尝试使用 CSS 更改文本。是否有任何选择器可以识别下面的标签,如果有,我怎样才能让文本显示“组织”而不是“公司”这个词?谢谢你。
<div class="control-group">
<label class="control-label" for="company" style="">Company</label>
<div class="controls">
<input id="settings-company" class="settings-company input-xlarge" type="text" data-config="required" value="My Organization" name="company">
</div>
</div>
回答by drip
Hide the text with font-size:0;
and add a pseudo element.
隐藏文本font-size:0;
并添加一个伪元素。
label { font-size: 0; }
label:before { content: "Organization"; font-size: 14px; }