1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00
Files
locomotive-boilerplate/assets/styles/generic/_media.scss

53 lines
1.0 KiB
SCSS
Raw Normal View History

// ==========================================================================
// Generic / Media
// ==========================================================================
// 1. Setting `vertical-align` removes the whitespace that appears under `img`
// elements when they are dropped into a page as-is. Safer alternative to
// using `display: block;`.
2022-05-12 16:15:44 +02:00
audio,
canvas,
iframe,
img,
svg,
video {
2022-05-12 16:15:44 +02:00
vertical-align: middle; // [1]
}
// Add the correct display in iOS 4-7.
2022-05-12 16:15:44 +02:00
audio:not([controls]) {
display: none;
height: 0;
}
// 2. Fluid media for responsive purposes.
2022-05-12 16:15:44 +02:00
img,
svg {
2022-05-12 16:15:44 +02:00
max-width: 100%; // [2]
2017-04-27 16:00:45 -04:00
height: auto;
// 4. If a `width` and/or `height` attribute have been explicitly defined,
// lets not make the image fluid.
2022-05-12 16:15:44 +02:00
&[width], // [4]
2017-04-27 16:00:45 -04:00
&[height] {
2022-05-12 16:15:44 +02:00
// [4]
max-width: none;
}
}
// 4. Offset `alt` text from surrounding copy.
2022-05-12 16:15:44 +02:00
img {
2022-05-12 16:15:44 +02:00
font-style: italic; // [4]
}
// 5. SVG elements should fallback to their surrounding text color.
2022-05-12 16:15:44 +02:00
svg {
2022-05-12 16:15:44 +02:00
fill: currentColor; // [5]
}