html - 如何处理两种类型的输入框?

标签 html input

如何创建一个包含两部分的输入框,第一部分不可使用默认文本编辑,其余部分可由用户编辑。

<input type='text' value='read only'><input type='text' value='editable>

在 1 个输入中混合 2 个输入。

最佳答案

您可以尝试混合两个输入,使其看起来像@DoeNietZoMoeilijk 建议的那样。

你可以通过 HTML 和 CSS 来实现,试试这个:

HTML:

<input type="text" value="Read only" id="first" readonly="readonly" />
<input type="text" value="Editable" id="second" />

CSS:

#first {
    border-right: none;
}

#second {
    border-left: none;
    margin-left: -5px;
}

Here is example in jsfiddle

这里是示例片段:

#first {
    border-right: none;
}

#second {
    border-left: none;
    margin-left: -5px;
}
<input type="text" value="This is read only part" id="first" readonly="readonly" />
<input type="text" value="Editable" id="second" />

关于html - 如何处理两种类型的输入框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21133445/

相关文章:

html - 有没有更简单的方法,初学者可以理解?

javascript - HTML5 图像拖动事件 - ctrlKey 在 Firefox 29 中仍然为 false

c++ - 结构成员的文件输入示例?

jquery - "Clickable" Canvas 驱动的翻页演示中的链接和文本输入

php - 为什么隐藏输入会影响我的布局?低频解释

jquery - 如何在溢出 :hidden area? 中添加 DOM 元素

html - 更改行背景图像宽度而不影响行的最大宽度

java - Selenium WebDriver - 当元素具有动态 id 时如何获取元素的 id?

javascript - JS : Changing an input's text(value) on file input file select

Python 创建用户输入表单并将输入转换为数据帧