*, *:before, *:after { box-sizing: inherit; } html { box-sizing: border-box; }
box-sizing
, if necessary, for a specific area, for example, if a project has been added to a project that has box-sizing: content-box;
body { margin: 0; background-color: #fff; line-height: 1; text-rendering: optimizeLegibility; text-decoration-skip: objects; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
text-rendering
- defines how the browser optimizes text rendering.optimizeLegibility
- high-quality display is more important than speed, allows kerning and ligatures.text-decoration-skip: objects;
text-decoration: underline;
unsharp (where it works).-webkit-text-size-adjust: 100%;
- prohibit the adjustment of font size after changing orientation in iOS.-webkit-font-smoothing: antialiased;
- makes the text more subtle in Safari on Macs (the outline is smoothed and sharp at the same time, it's nice to read.).-webkit-tap-highlight-color: transparent;
- removes blue highlighting when clicking on devices. :focus { outline: none; }
outline
often does not fit into the design. And the designers themselves rarely draw this state, therefore duplication of hover styles has become a frequent practice. .no-touch { &:hover, &:focus { ... } }
:hover, :focus, :active
). p, dd, dl, figure, blockquote { margin: 0; } /* <dl>. . (): dl>div*3>dd{value}+dt{prop} */ blockquote, q { quotes: none; } ul, ol { padding: 0; margin: 0; list-style-type: none; } table { border-collapse: collapse; border-spacing: 0; } th { font-weight: inherit; } h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; } audio, video { display: block; } img { display: block; border: none; /*max-width: 100%;*/ } iframe { border: none; } pre, code, kbd, samp { font-family: monospace, monospace; font-size: inherit; }
.description { h1, h2, h3, h4 { /* style */ } p { /* style */ } /* . . */ }
a { background-color: transparent; text-decoration: none; color: inherit; } abbr { border: none; text-decoration: none; } b, strong { font-weight: inherit; } i, em { font-style: inherit; } dfn { font-style: inherit; } mark { background-color: transparent; color: inherit; } small { font-size: inherit; } sub, sup { position: relative; vertical-align: baseline; font-size: inherit; line-height: 0; } sub { bottom: -.25em; } sup { top: -.5em; }
button, input, optgroup, select, textarea { padding: 0; margin: 0; border: none; border-radius: 0; box-shadow: none; background-color: transparent; font: inherit; /* , , */ color: inherit; letter-spacing: inherit; } button, input { overflow: visible; } button, select { text-align: left; text-transform: none; } button, [type='button'], [type='reset'], [type='submit'] { cursor: pointer; -webkit-appearance: none; } textarea { resize: none; overflow-y: auto; overflow-x: hidden; } button::-moz-focus-inner, [type='button']::-moz-focus-inner, [type='reset']::-moz-focus-inner, [type='submit']::-moz-focus-inner { border: none; padding: 0; } button:-moz-focusring, [type='button']:-moz-focusring, [type='reset']:-moz-focusring, [type='submit']:-moz-focusring { outline: none; } [type='number']::-webkit-inner-spin-button, [type='number']::-webkit-outer-spin-button { height: auto; } [type='search']::-webkit-search-decoration { -webkit-appearance: none; } [type='search'] { outline: none; } ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }
button
tag cannot be used as a flex container. On IOS, it will break.) fieldset { padding: 0; margin: 0; border: none; } legend { display: block; padding: 0; white-space: normal; }
fieldset
tag cannot be used as a flex container. It does not work simply.) select { -webkit-appearance: none; -moz-appearance: none; appearance: none; } select::-ms-expand { display: none; }
::-webkit-input-placeholder { color: inherit; opacity: 1; transition: opacity .3s; } ::-moz-placeholder { color: inherit; opacity: 1; transition: opacity .3s; } :-moz-placeholder { color: inherit; opacity: 1; transition: opacity .3s; } :-ms-input-placeholder { color: inherit; opacity: 1; transition: opacity .3s; } :focus::-webkit-input-placeholder { opacity: 0; } :focus::-moz-placeholder { opacity: 0; } :focus:-moz-placeholder { opacity: 0; } :focus:-ms-input-placeholder { opacity: 0; }
svg
tag, though a full-fledged tag that supports any properties, I always use a wrapper for it, which I set the dimensions and color. This approach is very convenient for working with sprites of 2 types. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <symbol id="search" viewBox="0 0 24 24"> <path></path> </symbol> </svg>
<svg class="alert__ico"> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../img/sprites/sprite.svg#search"></use> </svg>
svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.icon-ico-color:after { background-image: url("data:image/svg+xml,%3Csvg%20width%3D...; }
[class*='icon-']:after { content: ''; display: block; width: 100%; height: 100%; background-size: contain; background-position: center; background-repeat: no-repeat; }
<script> $(document).ready(function() { $("head").append("<link rel='stylesheet' type='text/css' href='../css/icons.min.css' />"); }) </script>
<div class="elem__ico"> <svg class="alert__ico"> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../img/sprites/sprite.svg#search"></use> </svg> </div> <div class="elem__ico icon-ico-color"></div>
[hidden] { display: none; // IE10 }
:disabled, .disabled { cursor: not-allowed; }
::-ms-clear { display: none; }
:-webkit-autofill { box-shadow: 0 0 100px #fff inset; -webkit-text-fill-color: currentColor; }
::selection { color: #fff; background-color: #004fe4; }
.clearfix:after { content: ''; display: block; clear: both; }
.visually-hidden { position: absolute; z-index: -1; width: 0; height: 0; padding: 0; margin: 0; border: none; overflow: hidden; }
display: none;
or the hidden
attribute is a bad idea, since the input loses its ability to receive focus, and the focus (as we know) is important..visually-hidden
then the input does not lose the ability to receive focus . <img>
<div class="img-wrap"> <img src="" alt=""> </div>
.img-wrap { position: relative; width: 30%; } .img-wrap:before { content: ''; display: block; padding-bottom: 60%; }
.cover-pic, .contain-pic { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .cover-pic { object-fit: cover; } .contain-pic { object-fit: contain; }
object-fit
IE. Because you have to use polyfil . html { height: 100%; } body { display: flex; flex-direction: column; min-height: 100%; } .footer-page { margin-top: auto; }
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { html { display: flex; flex-direction: column; } }
Source: https://habr.com/ru/post/420539/
All Articles