How to apply css background color to text only, in datatables cell


Tags: jquery,css,datatables,jquery-datatables

Problem :

I'd like to apply background color css to text in a datatable cell. Currenytly I can only apply the color to the whole cell, how can I apply it only to the text in the cell? Here is what I am using now:

$.each(aData, function(ii,value2){
          if (value.sTitle == "Priority" && aData[i] != ""){
              $('td:eq(' + i + ')', nRow).css('background-color', '#F6CED8');
            }   
        }); 


Solution :

Like the other user said. Put it inside div or p tags and change the background color of that specific object.


    CSS Howto..

    CSS selector: how to style items [1-2][5-6][9-10] etc by pair

    How can you print a page that has been altered by javascript?

    How to add ::after in the HTML link tag

    How can I use an inline style to add a shadow around the used portion of my page?

    How to center align the text?CSS

    How to use very large font sizes in Internet Explorer with CSS that won't affect design?

    How to handle long string where characters stick together

    How do I make a line break between divs inside a box?

    ASP.NET - how to retrieve CSS styles applied by javascript on page postback?

    Multiple buttons in CSS + Button with an image not showing properly

    How to use pure css selector to select hidden element

    How to solve Firefox 2.0 cross browser issues?

    Make image show when screen reaches a certain width (pixels)

    css responsive design: how to improve my page ?

    How to modify twitter widget in css

    Showing refresh button when animation is complete?

    How does this CSS produce a circle?

    How do nested vertical margin collapses work?

    How do I fix hover property of a div?

    How do I set dynamic width to a block element?

    How do i add a fading border to my nav bar CSS

    How to fade in a specific CSS property

    JavaFX editable tableview: How to change size and css of the TextField inside of TableCell?

    How to create a panel tab?

    How to get the Apple Javascript Split Flap Counter to run on pure CSS

    How can I align two icons on my webpage next to each other?

    How to use “all” property in CSS

    CSS: How to refer to a tag

    section to be trigger of show/hide content by click html/css only

    How to keep top of element static while bottom is dynamic. -CSS