Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 我需要把这个标签放在I';我已在文本框中/或文本框旁边创建。有什么想法吗?_Html_Css - Fatal编程技术网

Html 我需要把这个标签放在I';我已在文本框中/或文本框旁边创建。有什么想法吗?

Html 我需要把这个标签放在I';我已在文本框中/或文本框旁边创建。有什么想法吗?,html,css,Html,Css,我有以下代码,现在我一直在思考如何将标签放在文本框中/旁边,以给出1个元素的感觉,请: HTML <div style="position: relative; float: left; margin-left: 12px;"> <input type="text" class="theInput" /> <label class="theLabel">$ &nbsp; |</label> </div>

我有以下代码,现在我一直在思考如何将标签放在文本框中/旁边,以给出1个元素的感觉,请:

HTML

<div style="position: relative; float: left;  margin-left: 12px;">
    <input type="text" class="theInput" />
    <label class="theLabel">$    &nbsp;  |</label>
</div>
<div style="position: relative; float: left;  margin-left: 12px;">
    <div class="price">
        <label class="theLabel">&euro;</label>
        <input type="text" class="theInput" value="000">
    </div>
</div>
这是需要的:

您可以这样做(调整您的需求):

CSS

.theInput {
    -webkit-appearance: none;
    -moz-appearance: none;
    text-overflow: ellipsis;
    color: #333333; 
    outline: none;
    border: 1px solid #E4EBED;
    border-radius: 3px;
    width: 70px;
    height: 32px;
    line-height: 25px;
    font-size: 16px;
    vertical-align: middle;
    background-color: #fff; 
    padding-left:45px;

}


.theLabel {
    position:absolute;
    z-index:999;
    -webkit-appearance: none;
    -moz-appearance: none; 
    color: #333333; 
    outline: none; 
    width: 34px;
    height: 32px;
    line-height: 30px;
    font-size: 20px; 
    background-color: #fff; 
    margin-left:-106px; 
    font-weight: bold;
    cursor:default;
}
.theInput {
    -webkit-appearance: none;
    -moz-appearance: none;
    text-overflow: ellipsis;
    color: #333333;
    outline: none;
    border: 1px solid #E4EBED;
    border-radius: 0px 3px 3px 0px;
    width: 70px;
    height: 32px;
    line-height: 25px;
    font-size: 16px;
    vertical-align: middle;
    background-color: #fff;
    padding-left:45px;
    display: inline-block;
    border-top: solid 1px #ccc;
    border-right: solid 1px #ccc;
    border-left: none;
    border-bottom: solid 1px #ccc;
}
.theLabel {
    position:relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    color: #333333;
    outline: none;
    width: 34px;
    height: 34px;
    line-height: 40px;
    font-size: 20px;
    background-color: #fff;
    font-weight: bold;
    cursor:default;
    float: left;
    display: inline-block;
    vertical-align: middle;
    border-top: solid 1px #ccc;
    border-left: solid 1px #ccc;
    border-bottom: solid 1px #ccc;
}
.theInput {
    border: none;
    padding: 5px 10px;
    max-width: 70px;
}

.price {
    border: 3px solid #333333;
}

.theLabel {
    padding: 0 10px;
    border-right: 1px solid black;
}

示例如下:

您应该像这样使用标签标签:

<label>Label Name: <input type="text" class="theInput"></label>
标签名称:
试试这个

HTML

<div style="position: relative; float: left;  margin-left: 12px;">
    <input type="text" class="theInput" />
    <label class="theLabel">$    &nbsp;  |</label>
</div>
<div style="position: relative; float: left;  margin-left: 12px;">
    <div class="price">
        <label class="theLabel">&euro;</label>
        <input type="text" class="theInput" value="000">
    </div>
</div>