javascript - 如何使用溢出-x : hidden on <input type = "number">

标签 javascript html css

这是一个例子

<style type = "text/css">
    .thequoteofpee {
        position: absolute;
        left: 464px;
        top: 362px;
        font-size: 20px;
        width: 420px;
        height: 40px;
        border-color: #00297A;
        border: 1px;
        border-style: solid;
        background-color: white;
        text-indent: 10px;
        }
</style>

<body>
<input name = "thequoteofpee" class = "thequoteofpee" type = "quote" placeholder = "Bio"/>
</body>

有谁知道如何让这个人只能输入 150 个字符。你是怎么做到的,所以有一个 text-indent 从右边进来,这样看起来更好。感谢任何试图回答这个问题的人!

附言 我没有什么可以给这个类(class)命名的,所以我给它起了一个奇怪的名字。

最佳答案

对于文本缩进,您可以改用填充,因此您可以控制四个值 top、right、bottom 和 left,而不是 text-indent 提供的一个值,就像这样:

    padding: 0 10px 0 10px;

限制字符的最大长度使用 maxlength="20"Update 使用它作为这样的属性

<input name = "thequoteofpee" class = "thequoteofpee" type = "quote" placeholder = "Bio" maxlength="20"/>

关于javascript - 如何使用溢出-x : hidden on &lt;input type = "number">,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33357205/

相关文章:

javascript - 通过函数填充Grunt任务配置的 'files'属性

html - 使用 CSS 调整一行中第三个 block 的宽度

css - 如何在水平滚动条的末尾修复一个 div?

javascript - 如何让抽屉出现在我网页其余部分的上方,以便看不到和无法点击底层元素?

javascript - 从 gridview RowCommand 调用 Javascript 函数

javascript - 使用回调的意义和原因?

css - 影响其他div的 float ?

javascript - JQuery 选择器在动态创建的内容中不起作用?

javascript - 使用 gulp 整合 CSS

javascript - 如何垂直居中引导模式?