jquery对齐页面的容器表
我有一个 HTML 页面,其中有许多嵌套表,例如页眉表和内容表以及页脚表,每个表都有一些子表,
问题是我无法访问表来为其提供 ID 或类,我只能将 JavaScript 或 css 文件附加到页面(因为它基于 oracle 门户)页面是全宽,所有表格均采用 100% 宽度,
我想将表格(仅限父级)大小重新调整为 1020px宽度,不接触这些表格,仅使用 jquery 或 css,
所以我这样做了,
$('body > table').width(1030);
$('body > table').css('margin','0 auto');
宽度被正确纠正并且表格在屏幕上居中,但表格现在在 Internet Explorer 上向左对齐,这意味着 .css(' margin','0 auto');
不适用于 Internet Explorer...
有什么建议吗?
I have an HTML page that has many nested tables, for example table for header and table for content and another for footer, and each table has some child tables
the problems is that I don't have access to tables to give them IDs or Classes, I can only attach JavaScript or css file to the page (because it's based on oracle portal) the page is full width, all tables take 100% width,
I want to re-size the tables ( the parents only) to be 1020px width, without touching those tables, only with jquery or css
so i did that
$('body > table').width(1030);
$('body > table').css('margin','0 auto');
the width is corrected alright and the tables are centered on the screen, but the tables are now aligned to left on internet explorer that means .css('margin','0 auto');
is not working on internet explorer...
any suggestion ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样使用 jQuery 完成这一切:
您的第一个 jQuery 行似乎可以设置表格的宽度属性,而不是 CSS 宽度属性。
Do it all with jQuery like this:
Your first jQuery line seems like it could be setting the width attribute of the table, not the CSS width property.