html - 如何让 CSS 完全删除溢出的文本部分?
问题描述
我的 div 中有一些文本,并且希望溢出的文本完全不被 css 显示。我知道如何通过overflow: hidden;
在下面的示例中使用来隐藏它,但在这种情况下,隐藏的文本仍然在页面中(例如它是可搜索的)。实际上我希望删除文本的溢出部分。
div {
background-color: #eee;
width: 200px;
height: 50px;
border: 1px dotted black;
overflow: hidden;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>Overflow</h2>
<div>You can use the overflow property when you want to have better control of the layout. The overflow property specifies what happens if content overflows an element's box. Searching "Overflow_Hide" word ctrl-F shows it is still present in the html page.</div>
</body>
</html>
解决方案
推荐阅读
- python - 我如何使用路径 Django 来定位和加载模板?Django 3.2
- r - “顺序错误(y):'orderVector1'中未实现的类型'list'”在绘制图形时
- laravel - 在 Laravel RouteServiceProvider 中返回 404
- python-3.x - 在 Matplotlib 的 FuncAnimation 方法中在动画期间传递参数
- command-line - Homebrew:安装卡在检查 Sudo 访问
- android - 如何检查具有不同路径的 URL 与 API 相同
- java - 将 JRE 与 launch4j 捆绑在一起
- java - 画布矩形位置
- typescript - 如何在 Azure Blob 存储中捕获上传失败瞬时错误?
- c++ - 为什么没有 std::string::append/insert recivieng 右值字符串?