首页
\
问答
\
如何使文本溢出与表标记一起使用(How to get text-overflow to work with table tag)
如何使文本溢出与表
如何使文本溢出与表标记一起使用(How to get text-overflow to work with table tag)
我有一个标签中有用户名的表。 我需要表响应,并能够处理长用户名。 随着表缩小我需要包装的名字和姓氏,但随后它继续缩小我想显示一个省略号,因为名称开始被切断。 我正在努力做这项工作。
如何让用户列以响应方式缩小,如何使文本按上述方式运行?
.leaderboard {
max-width: 800px;
}
.media-left, .media-body {
display: table-cell;
vertical-align: middle;
}
.media-left {
padding-right: 10px;
}
td a {
padding: 5px;
display: block;
text-decoration: none;
color: inherit;
}
.user-column {
max-width: 225px;
}
.leaderboard .name {
display: inline-block;
}
.truncate {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css" rel="stylesheet"/>
<table id="user-leaderboard" class="leaderboard table table-condensed">
<colgroup><col>
<col>
<col width="22%">
<col width="22%">
<col width="22%">
</colgroup><thead>
<tr>
<th class="text-center">Rank</th>
<th>User</th>
<th class="text-center">dataset1 </th>
<th class="text-center">dataset2 </th>
<th class="text-center">dataset3 </th>
</tr>
</thead>
<tbody class="user-rows">
<tr class="clickable-row" id="">
<td class="text-center"><a href="#">1</a></td>
<td class="user-column">
<a href="#">
<div class="media">
<div class="media-left media-middle">
<img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px">
</div>
<div class="media-body media-middle">
<div class="name truncate">First</div>
<div class="name truncate">Last</div>
</div>
</div>
</a>
</td>
<td class="text-center sort-column"><a href="#">6</a></td>
<td class="text-center "><a href="#">9</a></td>
<td class="text-center "><a href="#">3</a></td>
</tr>
<tr class="clickable-row" id="leaderboard-user-row">
<td class="text-center"><a href="#">2</a></td>
<td class="user-column">
<a href="#">
<div class="media">
<div class="media-left media-middle">
<img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px">
</div>
<div class="media-body media-middle">
<div class="name truncate">Reallyreallyrealylreallylongfirstname</div>
<div class="name truncate">Reallyreallyreallyreallyreallylonglastname</div>
</div>
</div>
</a>
</td>
<td class="text-center sort-column"><a href="#">4</a></td>
<td class="text-center "><a href="#">3</a></td>
<td class="text-center "><a href="#">3</a></td>
</tr>
<tr class="clickable-row" id="">
<td class="text-center"><a href="#">3</a></td>
<td class="user-column">
<a href="#">
<div class="media">
<div class="media-left media-middle">
<img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px">
</div>
<div class="media-body media-middle">
<div class="name truncate">Firstname</div>
<div class="name truncate">Lastnamelong</div>
</div>
</div>
</a>
</td>
<td class="text-center sort-column"><a href="#">3</a></td>
<td class="text-center "><a href="#">2</a></td>
<td class="text-center "><a href="#">3</a></td>
</tr>
</tbody>
</table>
I have a table with user names in a tag. I need the table to be responsive and to be able to handle long usernames. As the table shrinks I need the first and last name to wrap, but then as it continues to shrink I would like to show an ellipsis as the names start to get cut off. I am struggling to make this work.
How do I get the user column to shrink in a responsive way and how do I get the text to behave as I described above?
.leaderboard {
max-width: 800px;
}
.media-left, .media-body {
display: table-cell;
vertical-align: middle;
}
.media-left {
padding-right: 10px;
}
td a {
padding: 5px;
display: block;
text-decoration: none;
color: inherit;
}
.user-column {
max-width: 225px;
}
.leaderboard .name {
display: inline-block;
}
.truncate {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css" rel="stylesheet"/>
<table id="user-leaderboard" class="leaderboard table table-condensed">
<colgroup><col>
<col>
<col width="22%">
<col width="22%">
<col width="22%">
</colgroup><thead>
<tr>
<th class="text-center">Rank</th>
<th>User</th>
<th class="text-center">dataset1 </th>
<th class="text-center">dataset2 </th>
<th class="text-center">dataset3 </th>
</tr>
</thead>
<tbody class="user-rows">
<tr class="clickable-row" id="">
<td class="text-center"><a href="#">1</a></td>
<td class="user-column">
<a href="#">
<div class="media">
<div class="media-left media-middle">
<img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px">
</div>
<div class="media-body media-middle">
<div class="name truncate">First</div>
<div class="name truncate">Last</div>
</div>
</div>
</a>
</td>
<td class="text-center sort-column"><a href="#">6</a></td>
<td class="text-center "><a href="#">9</a></td>
<td class="text-center "><a href="#">3</a></td>
</tr>
<tr class="clickable-row" id="leaderboard-user-row">
<td class="text-center"><a href="#">2</a></td>
<td class="user-column">
<a href="#">
<div class="media">
<div class="media-left media-middle">
<img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px">
</div>
<div class="media-body media-middle">
<div class="name truncate">Reallyreallyrealylreallylongfirstname</div>
<div class="name truncate">Reallyreallyreallyreallyreallylonglastname</div>
</div>
</div>
</a>
</td>
<td class="text-center sort-column"><a href="#">4</a></td>
<td class="text-center "><a href="#">3</a></td>
<td class="text-center "><a href="#">3</a></td>
</tr>
<tr class="clickable-row" id="">
<td class="text-center"><a href="#">3</a></td>
<td class="user-column">
<a href="#">
<div class="media">
<div class="media-left media-middle">
<img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px">
</div>
<div class="media-body media-middle">
<div class="name truncate">Firstname</div>
<div class="name truncate">Lastnamelong</div>
</div>
</div>
</a>
</td>
<td class="text-center sort-column"><a href="#">3</a></td>
<td class="text-center "><a href="#">2</a></td>
<td class="text-center "><a href="#">3</a></td>
</tr>
</tbody>
</table>
原文:https://stackoverflow.com/questions/42079895
更新时间:2022-06-04 12:06
最满意答案
要在警报上单击“确定”:
driver.SwitchTo().Alert().Accept();
To click OK on an alert:
driver.SwitchTo().Alert().Accept();
相关问答
更多
-
TCP/IP模型是一个________。[2023-10-02]
a
-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a
-
C#Selenium Webdriver JavaScriptExecutor提示窗口(C# Selenium Webdriver JavaScriptExecutor Prompt Window)[2022-02-27]
所以这对于Selenium来说必须是一个非常常见的用例; 我的经历有限。 然而,谷歌搜索,我发现以下内容: Alert alert = driver.SwitchTo().Alert();
driver.SwitchTo().Alert().SendKeys("Hello");
alert.Accept();
(来自SeleniumEasy ) 我修复了C#实现的驼峰案例; 最初的例子是Java。 So this must be a pretty common use case for Selenium; ...
-
“在服务器(Nodejs)收到来自前端的帖子后?” 在浏览器中显示弹出窗口。 这是不可能做到的。 如果发布请求成功,我假设你想显示一个弹出窗口。 因为你提到了Ajax,这就是它的完成方式。 在服务器的后置路由器定义中执行如下操作 router.post('/path', function(req, res){
//do something
res.jsonp({success : true})
});
这样的事情。 最后你想从服务器向客户端发送一些东西。 在客户端javascript文件之后发 ...
-
Selenium:无法在IE浏览器中处理子窗口上的确认(Selenium : Unable to handle Confirmation on a child window in IE Browser)[2023-05-11]
我尝试使用较新版本的IE Web Driver,但这个问题不可重现。 I tried with newer version of IE Web Driver and this issue is not reproducible.
-
Selenium Webdriver C#Click工程然后在IE中超时(Selenium Webdriver C# Click works then times out in IE)[2022-07-27]
这不是一个新问题。 它已存在很长时间了。 我一直在阅读stackoverflow和谷歌小组的这个问题。 即使问题似乎是独一无二的(因为我已经使用了webdriver .net绑定大约两年而且从未遇到过这个问题),IEDriver服务器的作者有一个可靠的解释为什么会发生这种情况。 很多人建议增加隐性等待可能有所帮助,即使我怀疑会这样做。 阅读博客可以帮助您理解问题并找出问题所在。 This is not a new issue. It has been around for quite a long. I h ...
-
如本回答所述,您可以从selenium运行javascript代码。 你的代码将是这样的: WebDriver driver; // assume assigned elsewhere
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
string title = (string)js.ExecuteScript("document.title = 'hello'");
它将改变浏览器标题。 编辑 完整的工作代码: ChromeOp ...
-
警报或弹出式广告显示为插页式广告。 使用http://myurl.com/?interstitial=false ,此警报或弹出窗口将不会显示.. The Alert or Pop-Up displaying was an interstitial ad. Using http://myurl.com/?interstitial=false, This alert or pop-up will not display..
-
要在警报上单击“确定”: driver.SwitchTo().Alert().Accept();
To click OK on an alert: driver.SwitchTo().Alert().Accept();
-
如何强制警报窗口弹出(How to force alert window to pop-up)[2022-01-02]
不,没有。 谢天谢地。 (但是,您可以使用模态对话框伪造它 - 可能jQuery UI会满足您的需求) No, there isn't. Thank goodness. (you could, however, fake it with a modal dialog--possibly jQuery UI would suit your needs)
相关文章
更多
RabbitMQ Work模式消息队列
求教一个 table的css
Guava集合工具类-Table接口映射处理
Lua table(表、数组、字典)
Lua 元表(Metatable)改变table的行为
js 通过td的id值 如何拿到tr的id值?
Struts2 Push Tag 引发的问题
table-Oceanus配置说明
Don’t work. Be hated. Love someone.
div中table100%宽度的浏览器兼容性问题
最新问答
更多
您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
在计算机拍照在哪里进入
使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
单页应用程序:页面重新加载(Single Page Application: page reload)
在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
System.StackOverflow错误(System.StackOverflow error)
KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
企业安全培训的各项内容
错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
C#类名中允许哪些字符?(What characters are allowed in C# class name?)
NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
将多个行和可变行移动到列(moving multiple and variable rows to columns)
提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
Angular $资源不会改变方法(Angular $resource doesn't change method)
在Angular 5中不是一个函数(is not a function in Angular 5)
如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
常见的python rpc和cli接口(Common python rpc and cli interface)
Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
我有一个标签中有用户名的表。 我需要表响应,并能够处理长用户名。 随着表缩小我需要包装的名字和姓氏,但随后它继续缩小我想显示一个省略号,因为名称开始被切断。 我正在努力做这项工作。
如何让用户列以响应方式缩小,如何使文本按上述方式运行?
.leaderboard { max-width: 800px; } .media-left, .media-body { display: table-cell; vertical-align: middle; } .media-left { padding-right: 10px; } td a { padding: 5px; display: block; text-decoration: none; color: inherit; } .user-column { max-width: 225px; } .leaderboard .name { display: inline-block; } .truncate { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script> <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css" rel="stylesheet"/> <table id="user-leaderboard" class="leaderboard table table-condensed"> <colgroup><col> <col> <col width="22%"> <col width="22%"> <col width="22%"> </colgroup><thead> <tr> <th class="text-center">Rank</th> <th>User</th> <th class="text-center">dataset1 </th> <th class="text-center">dataset2 </th> <th class="text-center">dataset3 </th> </tr> </thead> <tbody class="user-rows"> <tr class="clickable-row" id=""> <td class="text-center"><a href="#">1</a></td> <td class="user-column"> <a href="#"> <div class="media"> <div class="media-left media-middle"> <img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px"> </div> <div class="media-body media-middle"> <div class="name truncate">First</div> <div class="name truncate">Last</div> </div> </div> </a> </td> <td class="text-center sort-column"><a href="#">6</a></td> <td class="text-center "><a href="#">9</a></td> <td class="text-center "><a href="#">3</a></td> </tr> <tr class="clickable-row" id="leaderboard-user-row"> <td class="text-center"><a href="#">2</a></td> <td class="user-column"> <a href="#"> <div class="media"> <div class="media-left media-middle"> <img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px"> </div> <div class="media-body media-middle"> <div class="name truncate">Reallyreallyrealylreallylongfirstname</div> <div class="name truncate">Reallyreallyreallyreallyreallylonglastname</div> </div> </div> </a> </td> <td class="text-center sort-column"><a href="#">4</a></td> <td class="text-center "><a href="#">3</a></td> <td class="text-center "><a href="#">3</a></td> </tr> <tr class="clickable-row" id=""> <td class="text-center"><a href="#">3</a></td> <td class="user-column"> <a href="#"> <div class="media"> <div class="media-left media-middle"> <img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px"> </div> <div class="media-body media-middle"> <div class="name truncate">Firstname</div> <div class="name truncate">Lastnamelong</div> </div> </div> </a> </td> <td class="text-center sort-column"><a href="#">3</a></td> <td class="text-center "><a href="#">2</a></td> <td class="text-center "><a href="#">3</a></td> </tr> </tbody> </table>
I have a table with user names in a tag. I need the table to be responsive and to be able to handle long usernames. As the table shrinks I need the first and last name to wrap, but then as it continues to shrink I would like to show an ellipsis as the names start to get cut off. I am struggling to make this work.
How do I get the user column to shrink in a responsive way and how do I get the text to behave as I described above?
.leaderboard { max-width: 800px; } .media-left, .media-body { display: table-cell; vertical-align: middle; } .media-left { padding-right: 10px; } td a { padding: 5px; display: block; text-decoration: none; color: inherit; } .user-column { max-width: 225px; } .leaderboard .name { display: inline-block; } .truncate { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script> <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css" rel="stylesheet"/> <table id="user-leaderboard" class="leaderboard table table-condensed"> <colgroup><col> <col> <col width="22%"> <col width="22%"> <col width="22%"> </colgroup><thead> <tr> <th class="text-center">Rank</th> <th>User</th> <th class="text-center">dataset1 </th> <th class="text-center">dataset2 </th> <th class="text-center">dataset3 </th> </tr> </thead> <tbody class="user-rows"> <tr class="clickable-row" id=""> <td class="text-center"><a href="#">1</a></td> <td class="user-column"> <a href="#"> <div class="media"> <div class="media-left media-middle"> <img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px"> </div> <div class="media-body media-middle"> <div class="name truncate">First</div> <div class="name truncate">Last</div> </div> </div> </a> </td> <td class="text-center sort-column"><a href="#">6</a></td> <td class="text-center "><a href="#">9</a></td> <td class="text-center "><a href="#">3</a></td> </tr> <tr class="clickable-row" id="leaderboard-user-row"> <td class="text-center"><a href="#">2</a></td> <td class="user-column"> <a href="#"> <div class="media"> <div class="media-left media-middle"> <img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px"> </div> <div class="media-body media-middle"> <div class="name truncate">Reallyreallyrealylreallylongfirstname</div> <div class="name truncate">Reallyreallyreallyreallyreallylonglastname</div> </div> </div> </a> </td> <td class="text-center sort-column"><a href="#">4</a></td> <td class="text-center "><a href="#">3</a></td> <td class="text-center "><a href="#">3</a></td> </tr> <tr class="clickable-row" id=""> <td class="text-center"><a href="#">3</a></td> <td class="user-column"> <a href="#"> <div class="media"> <div class="media-left media-middle"> <img class="img-rounded" src="http://twemoji.maxcdn.com/36x36/1f47e.png" width="36px"> </div> <div class="media-body media-middle"> <div class="name truncate">Firstname</div> <div class="name truncate">Lastnamelong</div> </div> </div> </a> </td> <td class="text-center sort-column"><a href="#">3</a></td> <td class="text-center "><a href="#">2</a></td> <td class="text-center "><a href="#">3</a></td> </tr> </tbody> </table>
原文:https://stackoverflow.com/questions/42079895
更新时间:2022-06-04 12:06
最满意答案
要在警报上单击“确定”:
driver.SwitchTo().Alert().Accept();
To click OK on an alert:
driver.SwitchTo().Alert().Accept();
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
C#Selenium Webdriver JavaScriptExecutor提示窗口(C# Selenium Webdriver JavaScriptExecutor Prompt Window)[2022-02-27]
所以这对于Selenium来说必须是一个非常常见的用例; 我的经历有限。 然而,谷歌搜索,我发现以下内容: Alert alert = driver.SwitchTo().Alert(); driver.SwitchTo().Alert().SendKeys("Hello"); alert.Accept(); (来自SeleniumEasy ) 我修复了C#实现的驼峰案例; 最初的例子是Java。 So this must be a pretty common use case for Selenium; ... -
“在服务器(Nodejs)收到来自前端的帖子后?” 在浏览器中显示弹出窗口。 这是不可能做到的。 如果发布请求成功,我假设你想显示一个弹出窗口。 因为你提到了Ajax,这就是它的完成方式。 在服务器的后置路由器定义中执行如下操作 router.post('/path', function(req, res){ //do something res.jsonp({success : true}) }); 这样的事情。 最后你想从服务器向客户端发送一些东西。 在客户端javascript文件之后发 ...
-
Selenium:无法在IE浏览器中处理子窗口上的确认(Selenium : Unable to handle Confirmation on a child window in IE Browser)[2023-05-11]
我尝试使用较新版本的IE Web Driver,但这个问题不可重现。 I tried with newer version of IE Web Driver and this issue is not reproducible. -
Selenium Webdriver C#Click工程然后在IE中超时(Selenium Webdriver C# Click works then times out in IE)[2022-07-27]
这不是一个新问题。 它已存在很长时间了。 我一直在阅读stackoverflow和谷歌小组的这个问题。 即使问题似乎是独一无二的(因为我已经使用了webdriver .net绑定大约两年而且从未遇到过这个问题),IEDriver服务器的作者有一个可靠的解释为什么会发生这种情况。 很多人建议增加隐性等待可能有所帮助,即使我怀疑会这样做。 阅读博客可以帮助您理解问题并找出问题所在。 This is not a new issue. It has been around for quite a long. I h ... -
如本回答所述,您可以从selenium运行javascript代码。 你的代码将是这样的: WebDriver driver; // assume assigned elsewhere IJavaScriptExecutor js = (IJavaScriptExecutor)driver; string title = (string)js.ExecuteScript("document.title = 'hello'"); 它将改变浏览器标题。 编辑 完整的工作代码: ChromeOp ...
-
警报或弹出式广告显示为插页式广告。 使用http://myurl.com/?interstitial=false ,此警报或弹出窗口将不会显示.. The Alert or Pop-Up displaying was an interstitial ad. Using http://myurl.com/?interstitial=false, This alert or pop-up will not display..
-
要在警报上单击“确定”: driver.SwitchTo().Alert().Accept(); To click OK on an alert: driver.SwitchTo().Alert().Accept();
-
如何强制警报窗口弹出(How to force alert window to pop-up)[2022-01-02]
不,没有。 谢天谢地。 (但是,您可以使用模态对话框伪造它 - 可能jQuery UI会满足您的需求) No, there isn't. Thank goodness. (you could, however, fake it with a modal dialog--possibly jQuery UI would suit your needs)