Partilhar via


Wrapping Text in a SharePoint WebPart Title

An interesting bit of CSS formatting behavior that I ran across recently at a customer site. They wanted to be able to have long titles in some of their web parts, but it would always make the web part zone expand to fit the text rather than wrapping the text. It turns out that the web part zone puts the title in a <nobr> tag.  As anyone who has done it knows, overriding an out-of-box web part or using reflection to modify its behavior can get ugly fast.  Out of curiosity, I suggested they try a CSS class that modifies the style of the <nobr> tag using the white-space:normal style.  They tried:

 .ms-standardheader nobr {
    white-space: normal;
}

 

and it worked. Now, this may not be news to all of you CSS gurus out there, but to me it was a surprise that you could override the behavior of a tag, not just override CSS styles. Useful information to keep in mind when branding a site and trying to wrestle web part html into submission.

Comments

  • Anonymous
    April 27, 2008
    PingBack from http://stevepietrek.com/2008/04/27/links-4272008/

  • Anonymous
    April 29, 2008
    TOPP-TIPP des Tages Tam Tam Euro 2008 European Championship Web Parts Ready for Download (free)! Tipps

  • Anonymous
    April 29, 2008
    TOPP-TIPP des Tages Tam Tam Euro 2008 European Championship Web Parts Ready for Download (free)! Tipps