Isaac
asked on
CSS and webparts
I created a web part page and added a few webparts. I would like to change it up a bit with CSS but it's not my greatest strenght.
The code below is a section I would like to change. I want the background-color to be #DDDDDD.
How would I do that in CSS? I want to put it in a CEWP.
Thanks.
The code below is a section I would like to change. I want the background-color to be #DDDDDD.
How would I do that in CSS? I want to put it in a CEWP.
Thanks.
<table TOPLEVEL border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr class="ms-WPHeader">
<td title="GA&CKO Directors Hatch - Use for formatted text, tables, and images." id="WebPartTitleWPQ3" style="width:100%;"><h3 class="ms-standardheader ms-WPTitle"><nobr><span>GA&CKO Directors Hatch</span><span id="WebPartCaptionWPQ3"></span></nobr></h3></td><td align="right" style="padding-right:2px"><div style="cursor: pointer" class="ms-HoverCellInActive" onmouseout="this.className='ms-HoverCellInActive'" onmouseover="this.className='ms-HoverCellActiveDark'"><nobr><a onclick="MSOWebPartPage_OpenMenu(MSOMenu_WebPartMenu, this, WebPartWPQ3,'False');return false;" id="WebPartWPQ3_MenuLink" onkeydown="MSOMenu_KeyboardClick(WebPartWPQ3_MenuLink, 13, 40)" href="#"><img src="/_layouts/images/Menu1.gif" border="0" align="absmiddle" title="GA&CKO Directors Hatch Web Part Menu" alt="GA&CKO Directors Hatch Web Part Menu" style="padding-left:2px;" /></a></nobr></div></td>
</tr>
</table></td>
</tr><tr>
<td class="" valign="top"><div WebPartID="f9df9cbc-adb4-4224-91e6-d6ffa9bf57ea" HasPers="false" id="WebPartWPQ3" width="100%" class="ms-WPBody" allowDelete="false" style="" ><P align=center><FONT color=#000040 size=6><STRONG>The Director's Page</STRONG></FONT></P></div></td>
</tr>
</table>
ASKER
Luckily, I just needed to add 1 line above what I posted.
<td id="MSOZoneCell_WebPartWPQ3" vAlign="top">
<table TOPLEVEL border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr class="ms-WPHeader">
<td title="GA&CKO Directors Hatch - Use for formatted text, tables, and images." id="WebPartTitleWPQ3" style="width:100%;"><h3 class="ms-standardheader ms-WPTitle"><nobr><span>GA&CKO Directors Hatch</span><span id="WebPartCaptionWPQ3"></span></nobr></h3></td><td align="right" style="padding-right:2px"><div style="cursor: pointer" class="ms-HoverCellInActive" onmouseout="this.className='ms-HoverCellInActive'" onmouseover="this.className='ms-HoverCellActiveDark'"><nobr><a onclick="MSOWebPartPage_OpenMenu(MSOMenu_WebPartMenu, this, WebPartWPQ3,'False');return false;" id="WebPartWPQ3_MenuLink" onkeydown="MSOMenu_KeyboardClick(WebPartWPQ3_MenuLink, 13, 40)" href="#"><img src="/_layouts/images/Menu1.gif" border="0" align="absmiddle" title="GA&CKO Directors Hatch Web Part Menu" alt="GA&CKO Directors Hatch Web Part Menu" style="padding-left:2px;" /></a></nobr></div></td>
</tr>
</table></td>
</tr><tr>
<td class="" valign="top"><div WebPartID="f9df9cbc-adb4-4224-91e6-d6ffa9bf57ea" HasPers="false" id="WebPartWPQ3" width="100%" class="ms-WPBody" allowDelete="false" style="" ><P align=center><FONT color=#000040 size=6><STRONG>The Director's Page</STRONG></FONT></P></div></td>
</tr>
</table>
</td>
Actually you need more because this "id" is dynamically generated id and can be changed if you will replace your web part in the feature. But we can do the trick with this dynamic id for now.
Please try this code for your CEWP:
this will set the background color for your table cells:
and this will set the set the background color for whole cell that contains your table:
Please try this code for your CEWP:
this will set the background color for your table cells:
<style type="text/css">
#MSOZoneCell_WebPartWPQ3 table td
{
background-color:#DDDDDD;
}
</style>
and this will set the set the background color for whole cell that contains your table:
<style type="text/css">
#MSOZoneCell_WebPartWPQ3
{
background-color:#DDDDDD;
}
</style>
ASKER
It works but it's not working....here's what I mean
The following does not work:
<style type="text/css">
#MSOZoneCell_WebPartWPQ3
{
background-color:#DDDDDD;
}
</style>
This works:
<style type="text/css">
#MSOZoneCell_WebPartWPQ3
{
background-color:red;
}
</style>
The following does not work:
<style type="text/css">
#MSOZoneCell_WebPartWPQ3
{
background-color:#DDDDDD;
}
</style>
This works:
<style type="text/css">
#MSOZoneCell_WebPartWPQ3
{
background-color:red;
}
</style>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! Is there a reasone why #DDDDDD did not work.
The only issue I can think about is the monitor issue.
Maybe you just can't see this color because it's too light on your display. Maybe you are working on the server via Remote Desktop?
This also can show you wrong colors.
Maybe you just can't see this color because it's too light on your display. Maybe you are working on the server via Remote Desktop?
This also can show you wrong colors.
ASKER
THANKS!
To overwrite the CSS style for this table you need something to identify this table.Something like "id" or "name" or "class". You don't have any of them so as long as there no parent selectors in CSS you need to find any element that containf this table and have an "id" or "name" or "class" attribute.
Example:
<div id="webpartzone">
The code you have been posted
</div>
In other words : please post here 10 additional lines of your source code that comes before the code you've been posted here before.