MediaWiki has some "content" styles that only apply inside .mw-body. However, skins often have layout styles on .mw-body (e.g. Vector), making it impossible to just add class="mw-body" anywhere (e.g. Vector adds margin-left and a blue border).
These need to be changed to either apply everywhere, if that's okay (essentially, replacing .mw-body foo with just foo), or changed to apply to a more narrow selector that can be added in random places (e.g. .mw-body-content).
Vector's styles for external links, headings, table of contents, etc. suffer from the same problem.
What this means in practice: if you want to have a heading styled like normal headings in Vector, or an external link styled with the usual icons, and your content is not inside <div class="mw-body"> (e.g. it's inside a OOjs UI dialog), you can't.
Previous attempts at resolving this (abandoned): https://gerrit.wikimedia.org/r/#/c/158803/ https://gerrit.wikimedia.org/r/#/c/158854/
resources/src/mediawiki.legacy/commonPrint.css: 106: .mw-body { 119: #column-content .mw-body { 172: .mw-body a.external.text:after, 173: .mw-body a.external.autonumber:after { 180: .mw-body a.external.text[href^='//']:after, 181: .mw-body a.external.autonumber[href^='//']:after { resources/src/mediawiki.legacy/oldshared.css: 466: html > body.rtl .mw-body ul#filetoc { resources/src/mediawiki.skinning/content.externallinks.css: 12: .mw-body a.external, 22: .mw-body a.external[href^="mailto:"], 30: .mw-body a.external[href^="ftp://"], 38: .mw-body a.external[href^="irc://"], 39: .mw-body a.external[href^="ircs://"], 47: .mw-body a.external[href$=".ogg"], .mw-body a.external[href$=".OGG"], 48: .mw-body a.external[href$=".mid"], .mw-body a.external[href$=".MID"], 49: .mw-body a.external[href$=".midi"], .mw-body a.external[href$=".MIDI"], 50: .mw-body a.external[href$=".mp3"], .mw-body a.external[href$=".MP3"], 51: .mw-body a.external[href$=".wav"], .mw-body a.external[href$=".WAV"], 52: .mw-body a.external[href$=".wma"], .mw-body a.external[href$=".WMA"], 60: .mw-body a.external[href$=".ogm"], .mw-body a.external[href$=".OGM"], 61: .mw-body a.external[href$=".avi"], .mw-body a.external[href$=".AVI"], 62: .mw-body a.external[href$=".mpeg"], .mw-body a.external[href$=".MPEG"], 63: .mw-body a.external[href$=".mpg"], .mw-body a.external[href$=".MPG"], 71: .mw-body a.external[href$=".pdf"], .mw-body a.external[href$=".PDF"], 72: .mw-body a.external[href*=".pdf#"], .mw-body a.external[href*=".PDF#"], 73: .mw-body a.external[href*=".pdf?"], .mw-body a.external[href*=".PDF?"], 82: .mw-body a.extiw, 83: .mw-body a.extiw:active { 88: .mw-body a.external { resources/src/mediawiki.skinning/elements.css: 53: .mw-body a.extiw, 54: .mw-body a.extiw:active { 58: .mw-body a.extiw:visited { 62: .mw-body a.extiw:active { 67: .mw-body a.external { 71: .mw-body a.external:visited { 75: .mw-body a.external:active { 79: .mw-body a.external.free { resources/src/mediawiki.special/mediawiki.special.search.styles.css: 20: /* needs extra specificity to override `.mw-body p` selector */ 21: .mw-body .mw-search-nonefound {
screen-hd.less: 5: .mw-body { components/common.less: 30: .mw-body { components/externalLinks.less: 3: .mw-body {