社区
CSS
帖子详情
怎样使一行文字限制在表格的一行内,多余的部分不显示?
yao0801
2004-12-28 01:55:51
就是比如有一行文字,很长,表格内一行显示不下,会跑到第二行,而我现在希望就输出一行,多余的部分不用显示,就限制在一行内,请问怎么做??谢谢!!
...全文
382
4
打赏
收藏
怎样使一行文字限制在表格的一行内,多余的部分不显示?
就是比如有一行文字,很长,表格内一行显示不下,会跑到第二行,而我现在希望就输出一行,多余的部分不用显示,就限制在一行内,请问怎么做??谢谢!!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
sfchina
2004-12-29
打赏
举报
回复
使用text-overflow样式
看看例子吧
<HTML>
<BODY>
<DIV STYLE="text-decoration:underline;color:darkRed;
font: bold 20px Arial;font-weight:bold">
Effect of CSS property <I>text-overflow</I></DIV>
<DIV STYLE="font: bold 16px Arial; color:darkRed; font-weight:bold">
Each box (DIV element) below contains the following text:</DIV>
<DIV >We hold these truths to be self-evident,
that all people are created equal.</DIV>
<DIV STYLE="font: bold 16px Arial;color:darkRed; font-weight:bold">
Note how the STYLE settings effect the rendering of the text</DIV>
<DIV STYLE="position: relative; height: 75px; top:10">
<DIV STYLE="position: absolute; left: 10px;
font: bold 16px Arial, sans-serif; color: blue; ">
STYLE ="text-overflow : clip; overflow : hidden"
<DIV STYLE="position: absolute; left: 0px; top: 18px; color: black;
width: 120px; height: 50px; border: 1px solid blue;
font: 14px Times New Roman, serif; overflow: hidden;
text-overflow:clip">
<NOBR>We hold these truths to be self-evident,
that all people are created equal.</NOBR>
</DIV>
</DIV>
<DIV STYLE="position: relative; height: 75px; top: 70">
<DIV STYLE="position: absolute; left: 10px;
font: bold 16px Arial, sans-serif; color: blue; ">
STYLE ="text-overflow : ellipsis; overflow : hidden"
<DIV STYLE="position: absolute; left: 0px; top: 18px; color: black;
width: 120px; height: 50px; border: 1px solid blue;
font: 14px Times New Roman, serif; overflow: hidden;
text-overflow:ellipsis">
<NOBR>We hold these truths to be self-evident,
that all people are created equal.</NOBR>
</DIV>
</DIV>
<DIV STYLE="position: relative; height: 75px; top:70">
<DIV STYLE="position: absolute; left: 10px;
font: bold 16px Arial, sans-serif; color: blue; ">
STYLE ="text-overflow : ellipsis; overflow : visible"
<DIV STYLE="position: absolute; left: 0px; top: 18px; color: black;
width: 120px; height: 50px; border: 1px solid blue;
font: 14px Times New Roman, serif; overflow: visible;
text-overflow:ellipsis">
<NOBR>We hold these truths to be self-evident,
that all people are created equal.</NOBR>
</DIV>
</DIV>
</BODY>
</HTML>
CodeBunny
2004-12-29
打赏
举报
回复
在表元内加个<Div>,文字放到DIV内,设置DIV高度为一行行高,并设置溢出部分剪切,就行了
newbreed
2004-12-28
打赏
举报
回复
<table width="100 style="TABLE-LAYOUT: fixed">
<tr>
<td>asdfasfdasdffasdfasdfasdfasdfasdf`112121212121313131331
</td>
</tr>
</table>
bzscs
2004-12-28
打赏
举报
回复
<table border="1" id="bzscs" width=50>
<tr>
<td><div style="width:33px;overflow: hidden">111111111111111</div></td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
文字
一行
显示
,
多余
部分
省略号代替
今天遇到一问题,
文字
需要
一行
显示
,多了用省略号代替 css进行解决 下面是一个小demo <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" ...
jq 控制td只
显示
一行
_CSS让
表格
里的内容强制
显示
一行
,超出长度
显示
省略号
在写html页面的时候,会经常用到
表格
,而且很多时候一个tr里边需要包含好几个td,这样就会导致tr的高度不一致,被撑开了这时候,如果能让td里的内容强制
显示
在
一行
,并让超出边界范围的内容
显示
点点,然后再给td加个...
css设置
一行
内
文字
超过宽度不换行,
多余
文字
显示
省略号
当
一行
文字
超过DIV或者Table的宽度的时候,浏览器中默认是让它换行
显示
的,如果我们不想让他换行
显示
那要怎么办呢?看到这个标题很容易就会想到截断
文字
加“…”的做法。 一般的
文字
截断(适用于内联与块): CSS== ...
html怎么设置只
显示
一行
,如何利用CSS控制文本只在
一行
显示
(不换行)
当
一行
文字
超过DIV或者Table的宽度的时候,浏览器中默认是让它换行
显示
的,如果不想让他换行要怎么办呢?通过CSS中的word-break,white-space可以达到不换行的效果。用CSS让
文字
在
一行
内
显示
不换行的方法一般的
文字
...
CSS
文字
多出
限制
宽度用...代替 鼠标移上后
显示
全部(笔记)
// 设置
文字
在
一行
显示
不能换行 overflow: hidden; //
文字
长度超过
限制
长度,则隐藏
显示
内容 text-overflow: ellipsis; //用省略号代替被隐藏的文本 white-space: nowrap; // 设置
文字
在
一行
显示
不能换行 ...
CSS
61,129
社区成员
60,711
社区内容
发帖
与我相关
我的任务
CSS
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
复制链接
扫一扫
分享
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章