Template:Crafting/styles.css: Difference between revisions
Template page
More actions
Create Template:Crafting, replicating minecraft.wiki's crafting-grid style without Lua |
m Fix box-sizing: this wiki applies border-box globally, which shrank the padded output slot instead of enlarging it as the copied minecraft.wiki sizing assumed |
||
| Line 1: | Line 1: | ||
/* Every width/height/padding/border combo below is copied verbatim | |||
from minecraft.wiki's own computed styles, which assume the browser | |||
default box-sizing (content-box) -- but this wiki's global reset | |||
sets box-sizing:border-box on everything, which would shrink each | |||
box's actual content area by its own padding+border instead of | |||
growing the box like the numbers below assume (most visible on the | |||
padded, larger .invslot-large output slot). box-sizing:content-box | |||
on every sized element here restores the original math regardless | |||
of that global default. */ | |||
/* Outer beveled GUI panel -- light top/left edge, dark bottom/right | /* Outer beveled GUI panel -- light top/left edge, dark bottom/right | ||
edge, the classic Minecraft "raised" 3D window border. Colors read | edge, the classic Minecraft "raised" 3D window border. Colors read | ||
directly off minecraft.wiki's own .mcui rule. */ | directly off minecraft.wiki's own .mcui rule. */ | ||
.mcui { | .mcui { | ||
box-sizing: content-box; | |||
display: inline-block; | display: inline-block; | ||
position: relative; | position: relative; | ||
| Line 26: | Line 37: | ||
.mcui-arrow { | .mcui-arrow { | ||
box-sizing: content-box; | |||
display: inline-block; | display: inline-block; | ||
width: 32px; | width: 32px; | ||
| Line 44: | Line 56: | ||
at two of its four corners; same trick minecraft.wiki uses. */ | at two of its four corners; same trick minecraft.wiki uses. */ | ||
.invslot { | .invslot { | ||
box-sizing: content-box; | |||
position: relative; | position: relative; | ||
display: inline-block; | display: inline-block; | ||
| Line 84: | Line 97: | ||
.invslot-item { | .invslot-item { | ||
box-sizing: content-box; | |||
position: relative; | position: relative; | ||
display: block; | display: block; | ||
| Line 93: | Line 107: | ||
.invslot-item a:first-child { | .invslot-item a:first-child { | ||
box-sizing: content-box; | |||
position: relative; | position: relative; | ||
display: block; | display: block; | ||
Revision as of 08:54, 24 August 2026
/* Every width/height/padding/border combo below is copied verbatim
from minecraft.wiki's own computed styles, which assume the browser
default box-sizing (content-box) -- but this wiki's global reset
sets box-sizing:border-box on everything, which would shrink each
box's actual content area by its own padding+border instead of
growing the box like the numbers below assume (most visible on the
padded, larger .invslot-large output slot). box-sizing:content-box
on every sized element here restores the original math regardless
of that global default. */
/* Outer beveled GUI panel -- light top/left edge, dark bottom/right
edge, the classic Minecraft "raised" 3D window border. Colors read
directly off minecraft.wiki's own .mcui rule. */
.mcui {
box-sizing: content-box;
display: inline-block;
position: relative;
background-color: #c6c6c6;
border-width: 2px;
border-style: solid;
border-color: #dbdbdb #5b5b5b #5b5b5b #dbdbdb;
padding: 6px;
text-align: left;
white-space: nowrap;
vertical-align: bottom;
color: #000000;
}
.mcui-input {
display: inline-block;
vertical-align: top;
}
.mcui-row {
display: block;
}
.mcui-arrow {
box-sizing: content-box;
display: inline-block;
width: 32px;
height: 27px;
margin: 40px 4px 0;
vertical-align: top;
}
.mcui-output {
display: inline-block;
vertical-align: top;
margin: 28px 0 0;
}
/* Each slot is "recessed" -- the opposite bevel direction from the
outer .mcui panel -- with a flat mid-grey fill. The ::before/::after
corner squares patch the 1px gaps a beveled border otherwise leaves
at two of its four corners; same trick minecraft.wiki uses. */
.invslot {
box-sizing: content-box;
position: relative;
display: inline-block;
background: center center / 32px 32px no-repeat #8b8b8b;
border-width: 2px;
border-style: solid;
border-color: #373737 #ffffff #ffffff #373737;
width: 32px;
height: 32px;
font-size: 16px;
line-height: 1;
text-align: left;
vertical-align: bottom;
}
.invslot::before,
.invslot::after {
content: "";
position: absolute;
background-color: #8b8b8b;
height: 2px;
width: 2px;
pointer-events: none;
}
.invslot::before {
bottom: -2px;
left: -2px;
}
.invslot::after {
top: -2px;
right: -2px;
}
/* The output slot is the same recessed square, just padded out larger. */
.invslot-large {
padding: 8px;
}
.invslot-item {
box-sizing: content-box;
position: relative;
display: block;
margin: -2px;
padding: 2px;
width: 32px;
height: 32px;
}
.invslot-item a:first-child {
box-sizing: content-box;
position: relative;
display: block;
margin: -2px;
padding: 2px;
width: 32px;
height: 32px;
}
.pixel-image img {
image-rendering: pixelated;
}
/* Bottom-right stack-size badge -- white Minecraft-style text with a
dark drop shadow instead of an outline, same as the game's own HUD. */
.invslot-stacksize {
position: absolute;
right: 0;
bottom: 0;
text-shadow: 2px 2px 0 #3f3f3f;
z-index: 2;
font-weight: normal;
color: #ffffff;
}