Asp.net calendar control won't stop having a silver title...! (css)
Trying to CSS it, I can CSS the cells, and the days of the week, and I think the top part that says the month, but the area around the month is silver, and no attempt at cssing it will change it - I tried all the different Css properties (I think) but it always en开发者_运维百科ds up being silver. It appears in the designer as silver too. I can't find a way to change this...ideas?
Just add this in the ASPX of your control:
TitleStyle-BackColor="Transparent"
That should solve the problem.
Unfortunately, this style is actually hard-coded into the Render method of the original ASP.NET Calendar object. You can use Reflector to see this. Yes, it's ridiculous. Use an alternative calendar object, or sublclass the calendar and fix the Render method. Not sure if this is fixed in 3.5...
The rendered HTML for the calendar control will probably contain an inline style definition by default e.g style="background-color: silver;"
, which will take precedence over CSS declarations unless they have the !important flag.
You could change this in the markup for the calendar control as a quick fix
<asp:Calendar id="cal1" runat="server">
<TitleStyle CssClass="classname" />
</asp:Calendar>
Try using IE Developer toolbar/Firebug + Firefox, and hover over the item that you want to change the color of. See if writing CSS for that items works.
can do what i did which is add a first child in your css. The calendar is still an HTML table. the first row how ever is not the header.
.calendar tr:first-child
{
background-color:lime;
}
精彩评论