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
 
Line 6: Line 6:
     overflow-x: auto;
     overflow-x: auto;
     max-width: 100%;
     max-width: 100%;
     padding: 2px 0 !important; /* tighter vertical padding */
     padding: 2px 0 !important; /* tighter */
     margin: 0 !important;
     margin: 0 !important;


     /* remove any default styling */
     /* remove any default styling */
     background: transparent !important;
     background: transparent !important;
    background-color: transparent !important;
     border: none !important;
     border: none !important;
     box-shadow: none !important;
     box-shadow: none !important;
Line 17: Line 16:


/* ============================================================
/* ============================================================
   REMOVE CITIZEN BLOCK/BACKGROUND ON DIRECT CHILD DIV
   REMOVE CITIZEN BLOCK/BACKGROUND
   ============================================================ */
   ============================================================ */
/* Citizen skins style all .mw-parser-output > div by default */
.mw-parser-output > .scrollable-math {
.mw-parser-output > .scrollable-math {
     background: none !important;
     background: none !important;
    background-color: transparent !important;
     border: none !important;
     border: none !important;
     box-shadow: none !important;
     box-shadow: none !important;
Line 29: Line 26:


/* ============================================================
/* ============================================================
   REMOVE INTERNAL BACKGROUNDS / BORDERS (Math extension)
   REMOVE BACKGROUNDS/BORDERS INSIDE THE MATH BLOCK
   ============================================================ */
   ============================================================ */
.scrollable-math *,
.scrollable-math *,
Line 45: Line 42:
.scrollable-math .mwe-math-element {
.scrollable-math .mwe-math-element {
     display: block;
     display: block;
     white-space: normal; /* allow proper wrapping */
     white-space: normal; /* clean line wrapping */
}
}


Line 54: Line 51:


/* ============================================================
/* ============================================================
   *** REDUCE VERTICAL SPACING BETWEEN FORMULAS ***
   *** REDUCE VERTICAL SPACING (COMPACT MODE) ***
   ============================================================ */
   ============================================================ */
.scrollable-math .mwe-math-element {
.scrollable-math .mwe-math-element,
     margin-top: 0.25em !important;   /* tight vertical spacing */
.scrollable-math math {
     margin-top: 0.25em !important;
     margin-bottom: 0.25em !important;
     margin-bottom: 0.25em !important;
     line-height: 1.1 !important;       /* more compact lines */
     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;
}
}


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


/* ============================================================
/* ============================================================
   REMOVE EMPTY PARAGRAPHS BEFORE/AFTER TEMPLATE
   COLLAPSE EMPTY PARAGRAPHS BEFORE / AFTER TEMPLATE
  (MediaWiki inserts <p></p> blocks automatically)
   ============================================================ */
   ============================================================ */
p + .scrollable-math,
p + .scrollable-math,
Line 76: Line 86:
     padding: 0 !important;
     padding: 0 !important;
     line-height: 0 !important;
     line-height: 0 !important;
     font-size: 0 !important; /* collapse whitespace paragraphs */
     font-size: 0 !important;
}
}


/* Restore normal text sizing inside the math block */
/* restore normal text inside scrollable-math */
.scrollable-math,
.scrollable-math,
.scrollable-math * {
.scrollable-math * {

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;
}