输入字段中无法删除的文本 [英] text in the input field which cannot be deleted
本文介绍了输入字段中无法删除的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个输入字段,例如
I've an input field such as
<input type="text" value="static text">
</input>
是否可能无法删除或选择static text
?这是必需的,以便用户可以在静态文本"之后输入文本.
Is it possible that static text
cannot be deleted or selected? This is required so that user can input text after the 'static text'.
推荐答案
我建议您这样做(仅HTML和CSS解决方案):
<label for='txt'>static text
<input type="text" id='txt' value=""/>
</label>
将您的input[type=text]
放在label
中,并提供一些我在此给出的ID,例如#txt
,并在CSS中进行一些样式设置,如下所示:
Put your input[type=text]
in a label
and give some id as i given here as #txt
and do some styling in the css as below:
#txt {
border:none;
outline:none;
}
label[for="txt"] {
border:solid 1px #d5d5d5;
padding: 0 0 0 5px;
}
这篇关于输入字段中无法删除的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文