Now my reactjs input field looked like this. Input field for eventName

正如您所看到的,文本只是一直向前移动,而不是向下移动到下一行.我该怎么解决这个问题?以下是我在此输入字段中的代码.

<input className="bg-slate-50 text-main-blue border border-gray-300 drop-shadow-lg text-sm rounded-md my-5 block w-full p-2.5 whitespace-normal word-break:break-word" type="text" name="eventName" placeholder="Event Name" required onChange={event => setEventName(event.target.value)} value={eventName}/> 

推荐答案

Change word-break:break-word to break-words

There is no class 100 in tailwind-css


这其实是textarea而不是text的工作,用type = "textarea"来得到想要的结果.

tailwind 工作:

使用divcontenteditableprops 和使用break-words属性

代码:

<div class="m-4 max-w-full overflow-y-hidden break-words border border-solid border-black text-4xl" contenteditable="true"></div>

输出:

enter image description here

Like : Tailwind Play

Css相关问答推荐

在css网格中用一个锚标签(顶部/底部边距)包装图像?

使用 Vuetify 的 sass 变量时出错

如何使用 tailwind css 修复滚动条始终位于底部?

滚动弹性盒

在具有特定类的 td 之后,如何编写适用于该行上所有 td 元素的表行的 CSS Select 器?

SASS 中的计算表达式

如何使用显示网格制作不同大小的列取决于元素的数量

semantic-ui-react 使输入使用全宽度可用

SASS 文件 struct :_typography、_layout 等中的相同 Select 器

如何仅包装左侧内容

使用 React-Router 和 Outlet 时如何确保内容保持在下方

在 CSS 中如何使用 100% 和最大内容之间的最大值

具有自动调整大小的自动填充行的 CSS 网格

CSS类和id同名

如何定位 CSS 网格布局中的特定列或行?

最大宽度与最小宽度

如何使内容出现在固定的 DIV 元素下方?

Chrome 呈现 colored颜色 的方式与 Safari 和 Firefox 不同

如何在 Flexbox 中禁用等高列?

在 Twitter Bootstrap 中创建圆角的正确方法