Craftsmanship, CSS & Vexillology
Companions
- Craftsman
- Guilds
- High quality
- Disciples / Masters
- Rules
Masterpiece
Journey
from learning, to discovering, to perfecting, to mastering.
Challenge
Build all the flags of the world in CSS
...with only one <div>
per flag.
Study of flags
- New world
- Specific vocabulary
- History
- Needed
width: 100px;
background: white;
border-left: 100px solid blue;
border-right: 100px solid red;
background-image:
linear-gradient(180deg,
red 0%, red 25%,
blue 25%, blue 50%,
yellow 50%, yellow 75%,
green 75%, green 100%
)
Layering
// Benin
background-image:
linear-gradient(90deg, green 0px, green 88px, transparent 88px),
linear-gradient(180deg, yellow 0px, yellow 50%, red 50%, red 100%);
vexilla-mundi.com
# Shell
scss -r ./geometry_helper.rb input.scss
# Ruby
module GeometryHelper
def cos(number)
Sass::Script::Number.new(Math.cos(
number.value * Math::PI / 180
))
end
end
// SCSS
$red-stripe-size: cos($alpha) * $height;
background-color: white;
background-image:
radial-gradient(
circle at 110px 74px,
red 44px,
transparent 44px
)
background: red;
&:before {
// BLACK STAR (U+2605)
content: "★";
color: yellow;
position: absolute;
top: 30px;
left: 66px;
font-size: 88px;
line-height: 88px;
}
Custom font
@font-face {
font-family: "Symbols";
src: url("../fonts/Symbols.woff");
[...]
}
background-image:
linear-gradient(180deg,
blue 0%, blue 33.33%,
white 33.33%, white 66.66%,
blue 66.66%, blue 100%
)
&:before {
content: "★";
color: blue;
top: 48px;
left: 103px;
text-shadow:
36px 9px 0px blue,
36px -9px 0px blue,
-36px 9px 0px blue,
-36px -9px 0px blue;
}
background-color: green;
background-image:
radial-gradient(
circle at 110px 41px,
green 45px,
transparent 45x
),
radial-gradient(
circle at 110px 55px,
yellow 47px,
transparent 47px
);
background-image:
linear-gradient(
180deg,
white 0, white 50%,
red 50%, red 100%
);
&:before {
display: block;
width: 110px;
height: 147px;
background-color: blue;
clip-path: polygon(0 0,
100% 50%,
0 100%
);
}
display: block;
width: 1px;
height: 1px;
background: transparent;
box-shadow: 0px 0px 0px #F99E0C,
1px 0px 0px #F99E0C,
2px 0px 0px #F99E0C,
3px 0px 0px #F99E0C,
4px 0px 0px #F99E0C,
5px 0px 0px #F99E0C,
6px 0px 0px #F99E0C,
7px 0px 0px #F99E0C,
8px 0px 0px #F99E0C,
[...]
https://github.com/pixelastic/img2cssWhat is important is the journey,
not the destination.