【问题标题】:How to create a table with CSS [closed]如何使用 CSS 创建表格 [关闭]
【发布时间】:2011-11-07 04:34:59
【问题描述】:

我想similar

  1. 如何选择第一行?
  2. 如何创建双系统?

很快我想创建漂亮的表格,但如何?

如果你有好的教程,请与我分享..

编辑:对不起,我的第一语言不是英语。双系统表示例如:

second line : blue 
third line : red 
fourth line : blue
...

【问题讨论】:

  • 您使用的是什么标记;什么是“双系统”?
  • 你想要“相似”...相似什么?该链接中有 10 个示例!
  • 你想要的 CSS 非常简单。比如:table { similar: true; first-line: selected; double-system: created; nice-tutorial: shared; }
  • 对不起,我的母语不是英语。双系统意味着例如:第二行:蓝色 - 第三行:红色第四行:蓝色....

标签: css html-table


【解决方案1】:

要选择表格的第一行,您可以使用jQuery

$("table:first > tr:first")

要操作该行的 css,您可以使用 .css() 方法:

var css = $("table:first > tr:first").css();

$("table:first > tr:first").css("color","red");

var cssObj = {
  'background-color' : 'Blue',
  'font-weight' : '',
  'color' : 'Black'
}

 $("table:first > tr:first").css(cssObj);

仅使用 CSS 您可以尝试使用 :nth-child 伪类选择器:

tr:nth-child(1) {
  brackground-color: Blue;
  color: Yellow;
}

tr:nth-child(2) {
  brackground-color: Yellow;
  color: Green;
}

tr:nth-child(3) {
  brackground-color: Red;
  color: White;
}

【讨论】:

    猜你喜欢
    • 2022-12-17
    • 2016-01-22
    • 2015-07-07
    • 2012-05-10
    • 1970-01-01
    • 2010-09-05
    • 2017-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多