我正在尝试将我的 div 表中的第一列和第一行设为粗体。 我设法把第一行加粗了。但是我不能让第一列看起来很粗。
下面你可以看到我的 html-css-javascript。如何使第一列看起来粗体?
<style type="text/css">
body {background: white; margin: 20px;}
h2 {margin: 20px 0;}
.zebraStyle > tbody > tr:nth-child(2n+1) > td {background: #e0e0d1;}
.firstRowStyle > tbody > tr:nth-child(1) > td {font-weight: Bold;}
.firstColumnStyle > tbody > tr:eq(1) {font-weight: Bold;}
</style>
<script type='text/javascript'>
var arr= [["", "2012", "2013", "2014(YTD)"],["Ferrari", 1460089088.3900001, 1637243070.99, 283566771.55000001],["Alfa Romeo", 1199141138.1900001, 1224624821.1500001, 192307335.49000001]];
$(document).ready( function(){
$('#myTable').handsontable({
data: arr,
minSpareRows: 1,
contextMenu: true,
readOnly: true,
fixedColumnsLeft: 1
});
$('#myTable').find('table').addClass('zebraStyle');
$('#myTable').find('table').addClass('firstRowStyle');
$('#myTable').find('table').addClass('firstColumnStyle');
});
</script>
</head>
<body>
<div id="myTable" class="handsontable" style="width: 400px; margin-left:auto; margin-right:auto; background-color:silver"></div>
</body>
最佳答案
使用下面的CSS
#myTable tr td:first-child{
font-weight:bold;
}
这将选择第一个 td
关于javascript - 如何选择 div 表的第一列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23675252/