Pregunta

I'm trying to make 1st column and 1st row in my div table bold. I managed to make 1st row bold. But i cannot make 1st column look bold.

Below you can see my html-css-javascript. How can i make first column look bold?

    <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>

¿Fue útil?

Solución 2

Using jQuery:

$("#myTable").find("td:first-child").css("font-weight", "bold");

Or with a css class:

.firstColumnStyle {font-weight: Bold;}

Add class with jquery:

$("#myTable").find("td:first-child").addClass("firstColumnStyle");

Note: Using only CSS in IE7 :first-child pseudo selector will not work on dynamic elements. Source

Otros consejos

use below css

#myTable tr td:first-child{
font-weight:bold;
}

this will select first td

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top