Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

单行、多行文本溢出 | 开箱即用的代码块 #14

Open
OBKoro1 opened this issue Aug 1, 2019 · 0 comments
Open

单行、多行文本溢出 | 开箱即用的代码块 #14

OBKoro1 opened this issue Aug 1, 2019 · 0 comments

Comments

@OBKoro1
Copy link
Owner

OBKoro1 commented Aug 1, 2019

博客链接

# 单行、多行文本溢出

老早之前的技能了,整理笔记发现的,不知道的可以看下:

# codepen

# 代码

html:

<p class="one">单行文本溢出显示省略号</p>
<p class="moreLine">多行文本溢出显示省略号 啦啦啦啦啦啦 哈哈哈哈</p>

css:

.one{
  width:100px; /* 记住要限定宽度 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.moreLine{
  width:100px; /* 记住要限定宽度 */
/*   height:300px; */  /* 也要限制高度,这边是自适应了 */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;  /* 限定几行文字溢出 */
  overflow: hidden;

}

# 点个Star支持我一下~

博客链接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant