From the course: SharePoint 2019: Customizing with Themes and CSS

Custom CSS elements: Initial considerations - SharePoint Tutorial

From the course: SharePoint 2019: Customizing with Themes and CSS

Start my 1-month free trial

Custom CSS elements: Initial considerations

- [Instructor] Up to this point, we've been making changes to existing CSS elements. We've been redefining them to make them look and act the way we want. But some of you are probably asking instead of cannibalizing existing CSS, why don't we just make new elements and define them exactly how we want them and then use them. Well, the simplest answer to that is yeah, you can do that but it's not that simple. We've already seen some fairly complicated code in HTML on a sharepoint site. It's pretty complex. There are multiple CSS sheets that get called and multiple element classes that might all be wrapped up in some places with a separate ID. It's a complicated spider web. If you modify existing CSS, you're not changing any of the underlying structure. You're only changing the way it behaves. If Microsoft makes changes to the code, they will typically reuse element names, which means your custom CSS definitions have a good likelihood of carrying over. If you make changes to your site's underlying HTML as people do when they create custom master pages, I can pretty much guarantee that it will fail on the next upgrade or prevent the upgrade from deploying. This means either staying at the release you're at and missing new features or the potential of a lot more development and maintenance time. Look, as I've said before, I don't want you creating extra work just because you can. I think you want a very solid business reason before you get involved with any not out of the box solution. Modifying CSS is bad enough. Creating extra is almost asking for trouble and once again, you only want to use CSS when you need to define behavior and appearance for an entire site. If you're just talking about a few pages, it's not worth the trouble. However, there are a few scenarios where I think that this has proven to be useful. There's one in particular that I've seen a few times and we'll explore it in the next few videos.

Contents