html、PHP网页设计,表格本来设置好了,添加bootstrap.css,表格严重变形,怎么使他不受css影响?

能用$function把表格包起来不受影响吗?还是有更好的办法!表格代码:
body {
text-align:left;
font-family: 'trebuchet MS', 'Lucida sans', Arial;
font-size: 14px;
color: #444;
}
table {
*border-collapse: collapse; /* IE7 and lower */
width: 200px;
border-spacing: 0;
margin-top:40px;
margin-left:80px;
}
.bordered {

border: solid #ccc 1px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 1px 1px #ccc;
-moz-box-shadow: 0 1px 1px #ccc;
box-shadow: 0 1px 1px #ccc;
}
.......
</style>中间一些代码略

两个办法:
1是先加载bootstrap.css 然后再加载你自己的css,这样,当table的样式跟bootstrap发生冲突的时候,你的自己的css就会有优先权。
例如
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.css">
<link rel="stylesheet" type="text/css" href="your.css">
</head>

2,另一种方法就是给你的table元素的样式加上!important标记,让你自己的样式有优先权,例如:
table {
*border-collapse: collapse; /* IE7 and lower */
width: 200px !important;
border-spacing: 0 !important;
margin-top:40px !important;
margin-left:80px !important;
}

以上两种方法都可以,但是要注意的是,表格变形还可能是因为有些值你没考虑到,没有写在你的css中,例如padding,display之类的,这些也会影响到表格的外观。建议你最好看看bootstrap.css里面所有的table相关的声明,然后再采取相关的修改
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-04-16
没见过这么开发的,最后再加 bootstrap 上去。。。没法判断,你什么都没提供,想要什么效果,现在变成什么样

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网