[英]Customizing text-wrap inside of a div
Basically what's going on is I'm wanting to add a little bit of styling to my text-wrapping, the styling that I'm looking for is to indent after the text wraps, so the text will look like this for example: 基本上,我要在文本包装中添加一些样式,我想要的样式是在文本换行后缩进,因此文本看起来像这样:
This is text that should be
wrapped.
However currently it looks like this: 但是当前它看起来像这样:
This is text that should be
wrapped.
Also, I'm trying to figure out how to properly disable the left-right scroll-bar in my chat-area and apply text-wrapping for "words" that don't have any spaces. 另外,我试图弄清楚如何在聊天区域中正确禁用左右滚动条,并为没有空格的“单词”应用文本换行。 Example below
下面的例子
Current: (Applies horizontal scroll) 当前:(应用水平滚动)
oejgoewgomgepoegwmopewjopvwemxdivheiwvmewcmoewmvnvpoewcewocmewinvew
Needed: 需要:
oejgoewgomgepoegwmop
ewjopvwemxdivhei
wvmewcmoewmvnvpo
ewcewocmewinvew
I've supplied images to show you guys what I currently have and what I'm looking for below 我提供的图像在下面向大家展示我目前所拥有的以及我正在寻找的东西
What I have: 我有的:
What I want: 我想要的是:
Looking on stack-overflow showed that setting the 查看堆栈溢出表明,设置
overflow-y: scroll;
property would only show the scroll bar horizontally, but that doesn't seem to be the case. 属性只会在水平方向显示滚动条,但事实并非如此。
If you need the css for my div, it's below: 如果您的div需要使用CSS,则如下所示:
#chatBoxDiv {
position: absolute;
background: white;
height: 20%;
width: 29%;
left: 1%;
bottom: 6%;
opacity: 0.6;
font-size: 12px;
overflow-y: scroll;
}
What you are looking for is word-break: break-all
for breaking long strings, and text-indent: -15px;
您正在寻找的是
word-break: break-all
用于断开长字符串, text-indent: -15px;
and padding-left
for indentation: 和
padding-left
缩进:
#chatBoxDiv { height: 100px; width: 200px; font-size: 12px; overflow-y: scroll; word-break: break-all; padding-left: 15px; text-indent: -15px; }
<div id="chatBoxDiv">oejgoewgomgepoegwmopewjopvwemxdivheiwvmewcmoewmvnvpoewcewocmewinvew</div>
word-wrap: break-word; 自动换行:断词; text-overflow: ellipsis;
文字溢出:省略号;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.