如何在ReactJS的输入字段内添加度量单位

时间:2020-08-31 05:07:23

标签: reactjs input

我有一个输入字段,我想在输入字段内输入测量单位。我得到这个

here is the wrong output

代替此 here is the right output

这是代码

<div className={classes.Shopping__count}>
    <input type="number" value={itemCount} step={props.count} onChange={itemCountHandler} className={classes.Shopping__count} />
    <span>{props.unit}</span>
</div>

1 个答案:

答案 0 :(得分:0)

尝试在跨度中添加一些CSS。例如

span.shift-left {
    left: -4em;
}
相关问题