Apologies for the unconventional title.
In C#, I am adding a div along with some text to a Control like this:
lit.Text = "<div class=\"event\">" + text + "</div>";
The styling for this is as follows:
.event:hover
{
background: #F0F0F0;
}
I want the background change to only apply to the text, not the entire div. Any suggestions?
UPDATE: Placing it within a span and styling the span partially solved the issue. However, I forgot to mention that the control I'm adding it to is a table cell. I had set:
style="width:50%"
This was causing the cell to occupy exactly half of the table's width, regardless of the text length or content in the adjacent cell on the same row. With the use of a span, this no longer holds true and results in misalignment of the table. Is there a way to correct this?