html - 将 HTML 表格拆分为多个 div

标签 html css

我在处理 HTML 表格时遇到问题。我希望我的表格显示为报纸写作风格。

Please Check Image

Desired Home Page sample

如果当前 div 列中填充了 50 条记录,我不知道如何跳转到另一个 div 列。我是 HTML 的新手。感谢您阅读我的问题。

当前的 HTML:

<html>
<head>
<style>
#quotescointainer{
width: 100%;
font-size: 4px;
overflow: hidden; /* contain floated elements */
background: #fff
}
#quotesleft {
float: left; 
width: 10%;
background-color: #fff;
}
#quotescenter { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter2 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter3 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter4 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter5 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter6 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter7 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotescenter8 { 
float: left;
background-color: #fff;
width: 10%;
}
#quotesright{
float: left;
width: 10%;
background-color: #fff;
}       
</style>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
font-size:0.7vw;
}

td, th {
border: 1px solid #000000;
text-align: left;
padding: 1px;
}

tr:nth-child(even) {
background-color: #dddddd;
}
</style>

    </head>
<body>
<div id="quotescointainer">
<div id="quotesleft">
    <?php echo file_get_contents("http://example.com/table?id=5452") ;?>
</div>
</div>
</body>
</html>

最佳答案

更容易解决您的问题的方法是使用 DataTables 插件。而且,它更清晰。

你可以只添加这样的东西,当然有你的喜好:

$(document).ready(function(){
    $('#myTable').DataTable();
});

See link

关于html - 将 HTML 表格拆分为多个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40973213/

相关文章:

php - 我想为响应式 bootstrap 3 模板显示相同的图像大小

javascript - 如何使用 javascript 隐藏最后一个自定义 div

css - 设备宽度和最大设备宽度有什么区别?

html - IE11 显示 html 页面的问题

html - CSS 选择器不工作 (~)

css - 在 Chrome 上使用 CSS 过滤器进行断断续续的转换

html - 仅在 CSS 文件中为 IE 指定 CSS 属性

javascript - Slick Carousel 问题幻灯片的视频背景

css - 防止无序列表中的列换行,将列表项对齐到列的顶部

html - 容器两侧的背景颜色不同