Question

I have 2 CQWP's in my Welcome Page for a document set.

By default, they look like this:

enter image description here

I was hoping there were an easy way I could either make the Names of the webparts Bold or Highlighted, like so:

enter image description here

Any pointers?

...I took some of the header out and only show down to one webpart.

" EncodeMethod='HtmlEncode'/>      

Was it helpful?

Solution

If I have understood correctly you just want to change the styling on the title of the web part so this is just CSS - no need to play with XSLT.

This is the standard tag at the top of a web part. If you create some CSS such as:

.ms-WPTitle {color: red}

This will style the title font - but note that it will style all the web part headers.

If you want to be more selective then you need to be more precise about which web parts you want to style. You can either do this by styling all web parts in a zone or by identifying the ID of the web part:

<td title="Content Query - Displays a dynamic view of content from your site." class="ms-WPHeaderTd" id="WebPartTitleWPQ6">

You can now use something like:

#WebPartTitleWPQ6 .ms-WPTitle {color: red}

This will now only style that specific web part.

EDIT:

You need to define some custom CSS that your page can make use of. If you are OK editing your page in SharePoint Designer then you need to add:

<style type="text/css">
     .ms-WPTitle {color: red}
</style>

This will usually go at the top of the page in the section. That should make the Title text on your web parts red. Assuming you get that far then you need to tweak the CSS to achieve the effect you would like.

OTHER TIPS

Jeez, it's been a very long time since I've even looked at XSLT but that's how you would style a Content Query Web Part. Microsoft's How-To is a decent starting point but there are years worth of blogs you can dig up that will provide better examples.

Another thing to consider is that Microsoft is phasing this technique out (which is why I can't provide a nice example link -- I've gotten rid of them all). It looks like you are using SharePoint 2010 but in SharePoint 2013 JavaScript Display Templates are king. I don't even think Microsoft recommends using CQWP anymore in SharePoint 2013. You may want to take that into consideration while building out your solution. You will be able to use your solution in SharePoint 2013 if you're using Content Query Web Parts but don't expect it to stick around for long looking into the future. Not sure what kind of resources you have but I would look into SharePoint 2013 rather than starting with SharePoint 2010.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top