- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
简短的版本:我有一个元素,我需要定义一个 DIV,它将水平重复,然后在空间不足时换行到下一行(类似表格的网格)。我见过提到 jQuery.GridLayout,但演示/主页是 404,所以我不知道这是否是我正在寻找的。简而言之,我正在努力实现这一目标:
Div.ItemClass Div.ItemClass Div.ItemClass Div.ItemClass
Div.ItemClass Div.ItemClass Div.ItemClass Div.ItemClass
...
诀窍是我被迫使用同一个类(我确实可以访问替代项模板,该模板将为每个替代项插入不同的代码),但我需要它们水平“堆叠”直到用完水平空间,然后“换行”到下一行。
快速背景 - 该元素位于 CMS 系统内,元素列表模块为我提供了以下模板文件以在“列表” View 中使用:
-Header
-Item
-Alternate Item
-Footer
想法、想法?
编辑:好的,所以我有点白痴,忘记了规则#1 - 检查你的(渲染的)源代码。最重要的问题是,正在使用的 CMS 模块将每个模板对象(页眉、元素、备用、页脚)“包装”在 TD 元素内,这使得真正的“包装 div”几乎不可能。我很高兴我没有发疯,因为我相当确定嵌套 DIV 是正确的方法。
编辑#2:好的,现在我想我可以通过一些 jQuery 操作来实现这一点。我需要定位 Div.ItemClass ,然后将它们放置在定位的包装 div 内,可能覆盖/替换现有的表格布局代码(可能在标题模板中使用?)。截至此编辑,渲染时强制执行的当前代码是:
<td><!--This is Header.html --><div class="Container" /></td>
<td><!--This is Item.html --><div class="ItemName">Item 1</div></td>
<td><!--This is Alternate.html --><div class="ItemName">Item 2</div></td>
<td><!--This is Item.html --><div class="ItemName">Item 3</div></td>
<td><!--This is Footer.html -->[PAGER]</td>
我希望这是有道理的,正如我之前所说,很多表是由我必须在该元素中使用的 CMS 和模块系统强制生成的。
编辑 #3 - 设法让它发挥作用!添加了一些 jQuery:
$(function() {
$('div.ItemClass').appendTo('#ContainerID');
});
简单地说,它从 TD 元素中获取 Div,并将它们放置在我放置在 Header.html 部分的 ContainerID 中!
最佳答案
如果你有固定的宽度,那就很容易了。只需将左浮动放在它们上并相应地安排宽度,以便只有 X 个元素位于一行上。类似的东西
<div class="container">
<div class="item">lorem ipsum</div>
<div class="item">lorem ipsum</div>
<div class="item">lorem ipsum</div>
<div class="item">lorem ipsum</div>
<div class="item">lorem ipsum</div>
<div class="item">lorem ipsum</div>
<div style="clear: both;"></div> <!-- just to fix the height, remove to see effect. -->
</div>
和风格
.container {
width: 500px;
}
.item {
width: 100px; // for 5 items (without margins)
float: left;
}
关于jquery - 流体 CSS 网格结构可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1863453/
.mid{ margin:0 auto; max-width:10em; min-width:5em; border:1px solid red; } ... 此代码创
我想用 制作 4 列元素: 第1列的宽度需要固定为200px。 其他 3 列需要动态划分它们之间的剩余宽度。 Column 1 Fixed 200px Column 2 Fluid Column 3
好的,我看到了 static , fluid , static 布局,但现在我的设计需要fluid, static, fluid 布局。 如: +---------------------------
我有以下 2 列 div 布局。左列需要有 75px 的宽度以容纳图像,但右列需要流入其所有父容器。 这个网格位于一个用户控件中,该控件被添加到多个站点/页面,每个站点/页面都有不同的布局,因此父容器
在此fiddle ,我在 dark-blue 的包装器中有一个图像,我希望它相对于它的包装器水平和垂直对齐 70%。 我尝试使用 table-cell,但它似乎不起作用。 HTML:
在 CSS 中获得此布局的最佳方法是什么?想象一下,我有三个 div,两个 div 在另一个里面。在两个内部 div 中,第一个具有特定的宽度集,第二个 div 预计会占用剩余空间。 通常我会在第二列
我对流体有点陌生,我想在流体中创建以下 php 语句。 if ($var == 'something') { // do something } elseif ($other-var == 's
仅当属性值 fileEn 时,我才尝试输出我的元素为 NULL ( fileEn => NULL ) {file} 然而,这也向我展示了 fileEn 不是 NULL 的元素! 最佳答案
简短的版本:我有一个元素,我需要定义一个 DIV,它将水平重复,然后在空间不足时换行到下一行(类似表格的网格)。我见过提到 jQuery.GridLayout,但演示/主页是 404,所以我不知道这是
我想不通 - 但我相信有人可以...我正在研究将新的流体宽度设置为 100%,并为内容包装器设置最小和最大宽度。 当页眉区域未设置为 overflow:hidden 时会出现问题 - 会出现一个大的水
我正在为一部即将上映的电影设计一个网站,但在让它适应所有浏览器窗口大小和屏幕大小方面遇到了一些问题。本质上,例如初始页面的标记在页面顶部有电影 Logo ,在其下方有一个视频(电影预告片),然后是一个
我正在构建一个由 50% 宽度的 div 和 25% 宽度的 div 组成的流动网站,我遇到的问题是对齐问题,尤其是与 Chrome。 我已经在这里上传了代码:http://tekulated.com
我正在尝试使用 twitter bootstrap 为我的网站做一个垂直的双色调背景(使用 css 渐变),这样渐变在连续流体的跨度之间的排水沟的中心结束。我已经有了渐变代码(如下所示),并且正在尝试
最近开始使用bootstrap,遇到如下问题:出现水平滚动条应该早得多。下面屏幕截图中的红色方 block 显示了表格旁边的空白区域没有填充任何信息,隐藏表/div。 HTML
我正在努力让这个布局稍微流畅一些。我希望#logo 位于#infobot 的右下角,其大小由我想随浏览器窗口缩放的图片决定。 #white 应该只是掩盖#logo 左侧的区域。如何让#white 和#
我们收到了一位客户的奇怪请求。他们想要一个特别的 的内容以图标为中心。居中本身不是问题,图标也不是。 问题是我找不到将 居中的方法s 的宽度可变,图标没有左对齐。 所以我们正在努力实现您在 http
我的网站有后台问题。我们的想法是不使用任何媒体查询,而是将所有内容都设置在 % 上,以便它始终可以在任何设备上查看。 我的问题是,背景图像确实具有适用于 with 的正确 css,但高度由 div 中
我正在对这个站点进行一些样式调整 http://neondataskills.org/ 我添加了一个顶部栏图像,现在,当您调整页面大小时,顶部栏图形如果太宽就会与导航重叠。我想强制图像将导航栏向下推。
我创建了一个带有面板和面板主体的容器。当我在桌面上查看该站点时,它看起来还不错。但是我在手机上看的时候,右边好像有一个很大的空间,什么也没有。 描述问题的图片 http://snag.gy/ApnWS
我有这样的布局: /*Sidebar*/ /*Column1*/ /*Column2*/ /*Column3*/ /*Sidebar*/ 所以现在我想做一个流畅的布局,在台式电脑上看起来不错,但在缩小
我是一名优秀的程序员,十分优秀!