- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个 <dl>
含短<dt>
文本,可能很长 <dd>
文本。在我使用它们的布局中,我希望它们并排显示:
/==============\
|DT DD........|
|DT DD........|
|DT DD........|
\==============/
但是,如果 DD 的内容太长,我只想将其截断(DL 上的 overflow: hidden
)。一种简单的方法是给 DD 一个最大宽度,以避免它太大而无法与固定大小的 DT 放在一行中。但是,由于容器的宽度已经固定并通过媒体查询更改,我更喜欢一种解决方案,我不必在 DD 中指定固定宽度的点。同时对 DT 和 DD 使用百分比也不是解决方案,因为在大容器的情况下,这会浪费 DT 中的空间。
显示问题的 fiddle :http://jsfiddle.net/ThiefMaster/fXr9Q/4/
当前的 CSS:
dl { border: 1px solid #000; margin: 2em; width: 200px; overflow: hidden; }
dt { float: left; clear: left; width: 50px; color: #f00; }
dd { float: left; color: #0a0; white-space: nowrap; }
最佳答案
更新:我应该先阅读你的整个问题。
脱下float:left;
在 <dd>
上
One possible problem for beginners using this property (as I already alluded to above) is that they assume that setting whitespace: nowrap on an element will prevent that element from dropping to the next line if it is part of a group of floated boxes. The white-space property, however, will only apply to the inline elements inside of the element its applied to, and will not affect block elements or the spacing of the element itself.
http://www.impressivewebs.com/css-white-space/
旧
因为您已经在 dl
上设置了宽度和 dt
, 将这个添加到 dd
:
dd{
overflow: hidden;
text-overflow: ellipsis;
width: 150px;
}
请注意 - 这是 CSS3 - 不适用于较旧的浏览器 - 它是由您评估这是否是一个问题 - 大多数时候我不介意较旧的浏览器选择稍微差一点的样式。
关于html - 并排定义列表而不换行太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12653246/
我在 Excel 中有两个图表,但我想将这些图表合并为一个图表。如您所见,我缩小了 graph1 中图表的大小。我想移动 graph2 中的图表进入graph1中的空白区域 最佳答案 我认为在基本的
我正在为我的站点构建一个 HTML 模板,并希望在左侧有一个主要内容 Pane ,在右侧有一个导航 Pane (类似于 Twitter)。 我假设 DIV 不是首选方法,因为默认情况下它们是从上到下列
我有以下 fiddle :http://jsfiddle.net/BFSH4/ 如您所见,有两个问题: h1 和 h2 没有垂直对齐。 导航和内容未水平对齐。 对于 1. 我已经尝试了 margin
在下面的示例中,我试图让“左”和“右”div 并排显示。显然我的理解是有缺陷的,但我犯了什么错误,因为(至少在 Chrome 中)它们没有并排出现。 谢谢
我在 chrome 上使用 Tampermonkey 向网页添加按钮。单击时,脚本会分析页面,然后显示警报。这是显示按钮的代码: function Main(){ GM_addStyle(
我的自定义键盘中有 UICollectionView,它有两行高度相同但宽度不同(大小来自服务器)的单元格,滚动方向是水平的。 我怎样才能并排显示集合项,而不用这种基于先前单元格宽度的奇怪居中? 最佳
任何人都可以帮助将两个位图图像组合成一个位图 在安卓中(并排)。 谢谢,尤瓦拉杰 最佳答案 您可以使用 Canvas - 查看这篇文章: http://www.jondev.net/articles/
如果有的话,设计 RPM 的“正确”方法是什么,以便可以通过 YUM/RPM 并排安装多个版本而不会相互干扰?对于库,正确的答案似乎与 sonames 有关,尽管我找不到任何关于 sonames、符号
从我的 last question 跟进:我执行了 Steve 提供的所有步骤,SxS Parse 日志为空,但我仍然收到“Class Not Registered”错误。 我知道我的 .exe 正在
我想并排显示两个图 block 层,就像并排的传单插件 ( https://github.com/digidem/leaflet-side-by-side )。 但是,我不知道如何用 react 来做
我正在制作一个将 PO 导出为 PDF 的采购订单系统,但我需要在上半部分显示来自买方和卖方的数据。我想并排放置 2 个 DetailView,每个都有 50% 的页面宽度。有可能的?到目前为止,我还
无论屏幕大小如何,我都试图并排 float 两个 div。目前在 IE 7 中,如果我调整窗口大小,一个 div 会下降到另一个下方。我认为这是因为 div2 包含一个表格,一旦窗口边缘碰到表格,它就
我想使用这个数据框的 geom_bar() 创建一个并排的条形图, > dfp1 value percent1 percent 1 (18,29] 0.20909091 0.454545
我正在尝试在 Xcode (Swift) 中创建一个单位转换器,并一直在尝试在 Storyboard 中对 UI 进行排序。我一直试图在屏幕的上半部分并排放置两个表格 View ,以保存两个测量类型的
下面的代码运行良好。 eventDrag 和 Drop 我可以放置在表格内的任何位置。 但是我只想将事件拖放到事件的左侧和右侧。 我想从其他事件的顶部和底部停止拖动事件。只有左侧和右侧的其他事件我想拖
我似乎无法让我的图层列表正常工作。 我需要
我想要类似 unix 中的 paste 命令,它需要两个文件并打印第一行,第一个文件,然后是分隔符,然后是第二个文件的第一行,然后是换行符,然后是第一个文件的第二行第二个文件的文件分隔符第二行,等等。
我想将我的内部应用程序的测试版本部署到我的测试组,我需要它与当前的 LIVE 版本一起安装。 我更改了发布选项中的所有内容,但它仍然会覆盖我的实时安装。我还需要做什么?我是否必须更改“应用程序”选项卡
我想创建一个设置,其中左侧有一个图像,右侧有一个 div。我正在使用 float left 来完成此操作,但我希望右侧的 div 与左侧的图像具有相同的高度,并且文本垂直居中。 这是一个jsfiddl
如何让两张 table 并排放置。问题可能会出现,有时一张 table 可能比另一张 table 大它旁边的表格,所以这可能会导致问题并且下面的表格可能不对齐,我想解决。在我制作的演示中,我有四个表,
我是一名优秀的程序员,十分优秀!