简体   繁体   English

CSS显示表与普通HTML表

[英]CSS display table vs normal HTML Table

For some reason I need to display tabular data in my web application but not using native, semantic table, thead, tbody, th, td tags. 由于某些原因,我需要在Web应用程序中显示表格数据,而不要使用本机,语义表,thead,tbody,th,td标签。 I found CSS properties that make html elements "look"/"behave" like tables: 我发现CSS属性使html元素像表一样“看起来” /“表现”:

http://www.quirksmode.org/css/display.html http://www.quirksmode.org/css/display.html

http://www.w3schools.com/cssref/pr_class_display.asp http://www.w3schools.com/cssref/pr_class_display.asp

http://developer.practicalecommerce.com/articles/1941-CSS-display-table-display-table-row-and-display-table-cell- http://developer.practicalecommerce.com/articles/1941-CSS-display-table-display-table-row-and-display-table-cell-

I've tried out a small test, but can't figure out using least effort how to make a CSS table look like a native html table: http://jsfiddle.net/rniestroj/6Lyvm/ The columns completly do not align. 我已经尝试了一个小测试,但无法找出如何使CSS表看起来像本地html表的方法: http : //jsfiddle.net/rniestroj/6Lyvm/列完全不对齐。 Maybe I should somewhere apply display: table-column ? 也许我应该在某处应用display: table-column But where? 但是哪里?

Or do I need more CSS and self sizing to make it look like the native table? 还是我需要更多CSS和自定义大小以使其看起来像本机表?

Or did I something misunderstood and it's not a 1:1 replacement? 还是我被误解了,不是1:1替代品?

Browser is Firefox 8.0b6. 浏览器是Firefox 8.0b6。

The problem is with: .body and .footer divs. 问题出在: .body.footer divs。 You don't assign style for them so they are rendered as "display: block"'s and break your layout. 您无需为它们指定样式,因此它们将呈现为“显示:块”,并破坏您的布局。 I added "display: table-row-group;" 我添加了“显示:table-row-group;” to .body , and "display: table-footer-group;" .body和“ display:table-footer-group;” to .footer . .footer This fixed it. 这样就解决了。

Example: http://jsfiddle.net/6Lyvm/9/ 示例: http//jsfiddle.net/6Lyvm/9/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 html表vs css显示表 - html table vs css display table css 显示:表与 html<div id="text_translate"><p> 当我做 web 布局时,我使用的是 html &lt;table&gt; 。 但是,我在互联网上读到 html 表只能用于数据,并且在进行布局时应使用&lt;div&gt;或&lt;span&gt; 。 我在互联网上搜索,发现关于display: table 。 我读过它并以我自己的理解(我不知道我是否理解正确)它与 html &lt;table&gt;相同。 我发现使用 html &lt;table&gt;更容易,因为它更简单。 我不必担心&lt;div&gt;的定位,因为大多数时候它会到达我不打算的位置。</p><p> 我的问题是:在布局中使用 html &lt;table&gt;的优缺点是什么?</p></div>,哪个更适合使用?<table> </table> - css display:table vs html <table>, Which is more appropriate to use? HTML,CSS - 显示表 - HTML, CSS - Display table HTML / CSS表格显示布局 - HTML/CSS table display layout 在 HTML/CSS 中垂直显示表格 - Display the table vertically in HTML/CSS HTML / CSS问题表显示 - HTML/CSS problems table display HTML / CSS表格显示问题 - HTML/CSS table display problems HTML和CSS显示表错误 - HTML and CSS display table error CSS:显示:块; vs 显示:表格; - CSS: display:block; vs display:table; 数据表的反向顺序以使用play框架或Normal html显示 - Reverse Order of Data table to display using play framework or Normal html
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM