zoukankan      html  css  js  c++  java
  • 表格边框css

    table标签默认是没有边框的,但是如果我们自己加上边框boder:1px solid black;只有整个表格最外面有边框,那么如何给表格添加样式使得整个表格的tr、td都具有边框呢:

     1 <style>
     2 table, th , td  {
     3   border: 1px solid grey;
     4   border-collapse: collapse;
     5   padding: 5px;
     6 }
     7 table tr:nth-child(odd)    {
     8   background-color: #f1f1f1;
     9 }
    10 table tr:nth-child(even) {
    11   background-color: #ffffff;
    12 }
    13 </style>

    上面代码中最后还加上了CSS3 :nth-child() 选择器对奇、偶行采用不同的背景色,同时也可以采用公式table tr:(2n+1)使用。

    努力吧,为了媳妇儿,为了家。。。
  • 相关阅读:
    Zabbix 3.2.1 安装 Graphtree3.0.4 或 Graphtree3.2.x
    jquery-1
    AngularJS (1)
    css-2 (Text Font)
    css
    Java经验
    js经验
    mysql经验
    MySQL 函数
    jquery 效果
  • 原文地址:https://www.cnblogs.com/jlj9520/p/5028009.html
Copyright © 2011-2022 走看看