Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Create an account below if you want to be able to make edits.

Template:Scrollable Math/styles.css: Difference between revisions

Template page
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* core scrollable container */
/* ============================================================
  CORE SCROLLABLE MATH CONTAINER
  ============================================================ */
.scrollable-math {
.scrollable-math {
  display: block;
    display: block;
  overflow-x: auto;
    overflow-x: auto;
  max-width: 100%;
    max-width: 100%;
  padding: 4px 0;
    padding: 2px 0 !important; /* tighter */
  margin: 0 !important;
    margin: 0 !important;
   background-color: transparent;
 
    /* remove any default styling */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
 
/* ============================================================
  REMOVE CITIZEN BLOCK/BACKGROUND
   ============================================================ */
.mw-parser-output > .scrollable-math {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
}
/* Neutralise paragraph immediately BEFORE or AFTER the template
 
  (works without :has() or :empty) */
/* ============================================================
p + .scrollable-math,
  REMOVE BACKGROUNDS/BORDERS INSIDE THE MATH BLOCK
.scrollable-math + p {
  ============================================================ */
  margin: 0 !important;
.scrollable-math *,
  padding: 0 !important;
.scrollable-math *::before,
  /* collapse any whitespace-only paragraph that was created */
.scrollable-math *::after {
  line-height: 0 !important;
    background: transparent !important;
  font-size: 0 !important;
    border: none !important;
    box-shadow: none !important;
}
}
/* restore readable text inside the math block (undo the zeroing) */
 
.scrollable-math,
/* ============================================================
.scrollable-math * {
  MULTILINE MATH FORMATTING
  font-size: initial !important;
  ============================================================ */
  line-height: normal !important;
.scrollable-math math,
.scrollable-math .mwe-math-element {
    display: block;
    white-space: normal; /* clean line wrapping */
}
}
/* Make Math extension elements behave and avoid boxed look */
 
/* Wide formulas scroll instead of shrinking */
.scrollable-math .mwe-math-element {
.scrollable-math .mwe-math-element {
  display: block;
    min-width: max-content;
  white-space: normal;
  min-width: max-content;    /* let wide formulas scroll */
  background-color: transparent;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
}
/* safety: prevent paragraph margins from reappearing due to skin rules */
 
p + .scrollable-math:first-child,
/* ============================================================
.scrollable-math + p:last-child {
  *** REDUCE VERTICAL SPACING (COMPACT MODE) ***
  margin: 0 !important;
  ============================================================ */
}/* core scrollable container */
.scrollable-math .mwe-math-element,
.scrollable-math {
.scrollable-math math {
  display: block;
    margin-top: 0.25em !important;
  overflow-x: auto;
    margin-bottom: 0.25em !important;
  max-width: 100%;
    line-height: 1.1 !important;
  padding: 4px 0;
}
  margin: 0 !important;
 
  background-color: transparent !important;
/* ============================================================
  SPECIAL FIX: <pre> INSIDE THE MATH BLOCK
  (this is where your unwanted margins come from)
  ============================================================ */
.scrollable-math pre {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1 !important;
    background: transparent !important;
    border: none !important;
}
 
/* If Citizen adds whitespace blocks inside pre, kill them */
.scrollable-math pre * {
    margin: 0 !important;
    padding: 0 !important;
}
}
/* Neutralise paragraph immediately BEFORE or AFTER the template
 
  (works without :has() or :empty) */
/* ============================================================
  COLLAPSE EMPTY PARAGRAPHS BEFORE / AFTER TEMPLATE
  ============================================================ */
p + .scrollable-math,
p + .scrollable-math,
.scrollable-math + p {
.scrollable-math + p {
  margin: 0 !important;
    margin: 0 !important;
  padding: 0 !important;
    padding: 0 !important;
  /* collapse any whitespace-only paragraph that was created */
    line-height: 0 !important;
  line-height: 0 !important;
    font-size: 0 !important;
  font-size: 0 !important;
}
}
/* restore readable text inside the math block (undo the zeroing) */
 
/* restore normal text inside scrollable-math */
.scrollable-math,
.scrollable-math,
.scrollable-math * {
.scrollable-math * {
  font-size: initial !important;
    font-size: inherit !important;
  line-height: normal !important;
    line-height: normal !important;
}
/* Make Math extension elements behave and avoid boxed look */
.scrollable-math .mwe-math-element {
  display: block;
  white-space: normal;
  min-width: max-content;    /* let wide formulas scroll */
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
/* safety: prevent paragraph margins from reappearing due to skin rules */
p + .scrollable-math:first-child,
.scrollable-math + p:last-child {
  margin: 0 !important;
}
 
 
.mw-parser-output .scrollable-math, .mw-parser-output .scrollable-math *{
  background-color: transparent !important;
}
}

Latest revision as of 09:59, 18 November 2025

/* ============================================================
   CORE SCROLLABLE MATH CONTAINER
   ============================================================ */
.scrollable-math {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    padding: 2px 0 !important; /* tighter */
    margin: 0 !important;

    /* remove any default styling */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ============================================================
   REMOVE CITIZEN BLOCK/BACKGROUND
   ============================================================ */
.mw-parser-output > .scrollable-math {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* ============================================================
   REMOVE BACKGROUNDS/BORDERS INSIDE THE MATH BLOCK
   ============================================================ */
.scrollable-math *,
.scrollable-math *::before,
.scrollable-math *::after {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ============================================================
   MULTILINE MATH FORMATTING
   ============================================================ */
.scrollable-math math,
.scrollable-math .mwe-math-element {
    display: block;
    white-space: normal; /* clean line wrapping */
}

/* Wide formulas scroll instead of shrinking */
.scrollable-math .mwe-math-element {
    min-width: max-content;
}

/* ============================================================
   *** REDUCE VERTICAL SPACING (COMPACT MODE) ***
   ============================================================ */
.scrollable-math .mwe-math-element,
.scrollable-math math {
    margin-top: 0.25em !important;
    margin-bottom: 0.25em !important;
    line-height: 1.1 !important;
}

/* ============================================================
   SPECIAL FIX: <pre> INSIDE THE MATH BLOCK
   (this is where your unwanted margins come from)
   ============================================================ */
.scrollable-math pre {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1 !important;
    background: transparent !important;
    border: none !important;
}

/* If Citizen adds whitespace blocks inside pre, kill them */
.scrollable-math pre * {
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================================
   COLLAPSE EMPTY PARAGRAPHS BEFORE / AFTER TEMPLATE
   ============================================================ */
p + .scrollable-math,
.scrollable-math + p {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

/* restore normal text inside scrollable-math */
.scrollable-math,
.scrollable-math * {
    font-size: inherit !important;
    line-height: normal !important;
}