Is there any way to specify a CSS class for a Content Query web part? I tried setting its CssClass property but it didn't do anything.
|
You might have to get specific when setting it. classname {}will not overwrite (from what I remember) body div div#classname {} From what I remember SharePoint likes to be specific. Use the Developers Tools in IE/Firefox/Chrome to find out what styles are being applied. For example Chrome will tell you exactly what style is being used ( like div div span div classname {} ). Once you know what is exactly being used you can reset that. |
|||
|
|
|
You can also adapt the XSL which drives the CQWP to meet you own needs. Usually people do this the create new display options, but you might also do it to apply your own styles. Look in the Style Library for the file. Another option would be to use script, but it's probably overkill. It's much better to just create overrides for the styles the CQWP uses in your own CSS file. |
|||
|
|
|
A work-around is to set the __WebPartId attribute of the web part in SharePoint designer. I have done this for an XSLT View Web Part:
This is rendered as follows:
You can than apply styling to it with a CSS attribute selector:
It is not a great way because the attribute selectors are rather slow but it works... |
||||
|
|
|
|||
|
|