{"id":73,"date":"2015-06-27T03:04:00","date_gmt":"2015-06-27T03:04:00","guid":{"rendered":"https:\/\/bangimportant.itgroove.net\/?p=73"},"modified":"2023-02-24T21:39:43","modified_gmt":"2023-02-24T21:39:43","slug":"sharepoint-web-part-style","status":"publish","type":"post","link":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/","title":{"rendered":"SharePoint Web Part Style"},"content":{"rendered":"<p>Looking to add a bit of sass to your web parts? With this bit of jQuery and CSS, we&#8217;ll take control of the display of SharePoint web parts and their titles and icons.<\/p>\n<p>Here&#8217;s an example:<\/p>\n<p><a href=\"\/wp-content\/uploads\/sites\/14\/2015\/07\/webparttitles.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-79 size-full\" src=\"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg\" alt=\"webparttitles\" width=\"656\" height=\"200\" srcset=\"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg 656w, https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles-300x91.jpg 300w\" sizes=\"(max-width: 656px) 100vw, 656px\" \/><\/a><\/p>\n<p>In the script below, we&#8217;ll target the icon &lt;img&gt; that SharePoint allows you to set via the Web Part properties (Advanced &gt; Title Icon Image URL). We&#8217;re removing the width and height that are on the &lt;img&gt; tag so that we can control the size of the icon with CSS instead. Since we may not always have an icon set, we&#8217;ll add a class to the titles that have an image defined so that we can handle the styles differently in each case.<\/p>\n<p>[code lang=&#8221;js&#8221;]<br \/>\n&lt;script type=&quot;text\/javascript&quot;&gt;<br \/>\nfunction styleBubbles() {<br \/>\n    var itgImgColl = $(&quot;div.ms-webpart-zone div.ms-webpart-chrome div.ms-webpart-chrome-title h2.ms-webpart-titleText &gt; img&quot;);<br \/>\n    itgImgColl.each(function() {<br \/>\n        $(this).removeAttr(&#8216;width&#8217;)<br \/>\n        $(this).removeAttr(&#8216;height&#8217;);<br \/>\n    });<br \/>\n    $(&quot;div.ms-webpart-zone div.ms-webpart-chrome div.ms-webpart-chrome-title h2.ms-webpart-titleText &gt; img&quot;).parent().addClass(&quot;itgWebpartHasIcon&quot;);<br \/>\n}<br \/>\n_spBodyOnLoadFunctionNames.push(&quot;styleBubbles&quot;);<br \/>\n&lt;\/script&gt;<br \/>\n[\/code]<\/p>\n<p>[code lang=&#8221;css&#8221;]<br \/>\n\/*** Web Part Cells ***\/<br \/>\n.ms-webpart-chrome-title {<br \/>\n    background:#969A9C;<br \/>\n    padding:10px 15px 5px<br \/>\n}<\/p>\n<p>.ms-webpart-chrome-title .js-webpart-titleCell .ms-webpart-titleText,.ms-webpart-chrome-title .ms-webpart-titleText &gt; a {<br \/>\n    text-decoration:none;<br \/>\n    color:#fff<br \/>\n}<\/p>\n<p>.ms-webpart-chrome-title .ms-webpart-titleText &gt; a:hover {<br \/>\n    color:#eaedf1<br \/>\n}<\/p>\n<p>.ms-headerCellStylePressed {<br \/>\n    background:#dbdfe5<br \/>\n}<\/p>\n<p>\/*** Web Part Content Space ***\/<br \/>\n.ms-wpContentDivSpace {<br \/>\n    padding:15px;<br \/>\n    background:#fff<br \/>\n}<\/p>\n<p>\/* web part title icons *\/<br \/>\nh2.itgWebpartHasIcon {<br \/>\n    padding-left:37px<br \/>\n}<\/p>\n<p>h2.itgWebpartHasIcon img {<br \/>\n    position:absolute;<br \/>\n    vertical-align:top;<br \/>\n    width:55px;<br \/>\n    height:53px;<br \/>\n    top:-6px;<br \/>\n    left:-10px<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>Happy styling!<\/p>\n<h2 class=\"hide\">sharepoint web part style<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Looking to add a bit of sass to your web parts? With this bit of jQuery and CSS, we&#8217;ll take control of the display of SharePoint web parts and their titles and icons. Here&#8217;s an example: In the script below, we&#8217;ll target the icon &lt;img&gt; that SharePoint allows you to set via the Web Part &hellip; <a href=\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/\"><\/a><\/p>\n","protected":false},"author":4,"featured_media":79,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2,3,5,7,8,9],"tags":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SharePoint Web Part Style - Archive<\/title>\n<meta name=\"description\" content=\"SharePoint web part style - make your web parts pop and gain more control of title icons.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SharePoint Web Part Style - Archive\" \/>\n<meta property=\"og:description\" content=\"SharePoint web part style - make your web parts pop and gain more control of title icons.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/\" \/>\n<meta property=\"og:site_name\" content=\"Archive\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-27T03:04:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-24T21:39:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"656\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Matt Lonpre (Alumni)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matt Lonpre (Alumni)\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/\",\"url\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/\",\"name\":\"SharePoint Web Part Style - Archive\",\"isPartOf\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg\",\"datePublished\":\"2015-06-27T03:04:00+00:00\",\"dateModified\":\"2023-02-24T21:39:43+00:00\",\"author\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/0deb86ff016aebc76f86a79a0e7236d0\"},\"description\":\"SharePoint web part style - make your web parts pop and gain more control of title icons.\",\"breadcrumb\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#primaryimage\",\"url\":\"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg\",\"contentUrl\":\"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg\",\"width\":656,\"height\":200},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog Archive\",\"item\":\"https:\/\/regroove.ca\/archive\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SharePoint Web Part Style\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/regroove.ca\/archive\/#website\",\"url\":\"https:\/\/regroove.ca\/archive\/\",\"name\":\"Archive\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/regroove.ca\/archive\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/0deb86ff016aebc76f86a79a0e7236d0\",\"name\":\"Matt Lonpre (Alumni)\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f084e0ef8fd6992834b5b085b737a7a2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f084e0ef8fd6992834b5b085b737a7a2?s=96&d=mm&r=g\",\"caption\":\"Matt Lonpre (Alumni)\"},\"url\":\"https:\/\/regroove.ca\/archive\/author\/mlongpre\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SharePoint Web Part Style - Archive","description":"SharePoint web part style - make your web parts pop and gain more control of title icons.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/","og_locale":"en_US","og_type":"article","og_title":"SharePoint Web Part Style - Archive","og_description":"SharePoint web part style - make your web parts pop and gain more control of title icons.","og_url":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/","og_site_name":"Archive","article_published_time":"2015-06-27T03:04:00+00:00","article_modified_time":"2023-02-24T21:39:43+00:00","og_image":[{"width":656,"height":200,"url":"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg","type":"image\/jpeg"}],"author":"Matt Lonpre (Alumni)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Matt Lonpre (Alumni)","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/","url":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/","name":"SharePoint Web Part Style - Archive","isPartOf":{"@id":"https:\/\/regroove.ca\/archive\/#website"},"primaryImageOfPage":{"@id":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#primaryimage"},"image":{"@id":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#primaryimage"},"thumbnailUrl":"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg","datePublished":"2015-06-27T03:04:00+00:00","dateModified":"2023-02-24T21:39:43+00:00","author":{"@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/0deb86ff016aebc76f86a79a0e7236d0"},"description":"SharePoint web part style - make your web parts pop and gain more control of title icons.","breadcrumb":{"@id":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#primaryimage","url":"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg","contentUrl":"https:\/\/regroove.ca\/archive\/wp-content\/uploads\/sites\/6\/2015\/07\/webparttitles.jpg","width":656,"height":200},{"@type":"BreadcrumbList","@id":"https:\/\/regroove.ca\/archive\/2015\/06\/27\/sharepoint-web-part-style\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Archive","item":"https:\/\/regroove.ca\/archive\/"},{"@type":"ListItem","position":2,"name":"SharePoint Web Part Style"}]},{"@type":"WebSite","@id":"https:\/\/regroove.ca\/archive\/#website","url":"https:\/\/regroove.ca\/archive\/","name":"Archive","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/regroove.ca\/archive\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/0deb86ff016aebc76f86a79a0e7236d0","name":"Matt Lonpre (Alumni)","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f084e0ef8fd6992834b5b085b737a7a2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f084e0ef8fd6992834b5b085b737a7a2?s=96&d=mm&r=g","caption":"Matt Lonpre (Alumni)"},"url":"https:\/\/regroove.ca\/archive\/author\/mlongpre\/"}]}},"_links":{"self":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/73"}],"collection":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":1,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":2800,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/73\/revisions\/2800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/media\/79"}],"wp:attachment":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}