github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/sass/sanitize.css/README.md (about) 1 # sanitize.css [<img src="https://csstools.github.io/sanitize.css/logo.svg" alt="sanitize" width="90" height="90" align="right">][sanitize.css] 2 3 [sanitize.css] is a CSS library that provides consistent, cross-browser 4 default styling of HTML elements alongside useful defaults. 5 6 It is developed alongside [normalize.css], which means every normalization 7 is included, and every normalization and opinion are clearly marked and 8 documented. 9 10 ## Usage 11 12 ```html 13 <link href="https://unpkg.com/sanitize.css" rel="stylesheet" /> 14 ``` 15 16 [Learn more about `sanitize.css`](#features). 17 18 #### Forms CSS 19 20 A separate stylesheet that normalizes form controls without side effects. 21 22 ```html 23 <link href="https://unpkg.com/sanitize.css/forms.css" rel="stylesheet" /> 24 ``` 25 26 [Learn more about `forms.css`](#forms). 27 28 #### Typography CSS 29 30 A separate stylesheet that normalizes typography using system interface fonts. 31 32 ```html 33 <link href="https://unpkg.com/sanitize.css/typography.css" rel="stylesheet" /> 34 ``` 35 36 [Learn more about `typography.css`](#typography). 37 38 #### Page CSS 39 40 A separate stylesheet that applies a comfortable measure to plain documents. 41 42 ```html 43 <link href="https://unpkg.com/sanitize.css/page.css" rel="stylesheet" /> 44 ``` 45 46 ## Install 47 48 ```sh 49 npm install sanitize.css --save 50 ``` 51 52 #### Webpack Usage 53 54 Import [sanitize.css] in CSS: 55 56 ```css 57 @import '~sanitize.css'; 58 @import '~sanitize.css/forms.css'; 59 @import '~sanitize.css/typography.css'; 60 ``` 61 62 Alternatively, import [sanitize.css] in JS: 63 64 ```js 65 import 'sanitize.css'; 66 import 'sanitize.css/forms.css'; 67 import 'sanitize.css/typography.css'; 68 ``` 69 70 In `webpack.config.js`, be sure to use the appropriate loaders: 71 72 ```js 73 module.exports = { 74 module: { 75 rules: [ 76 { 77 test: /\.css$/, 78 use: [ 'style-loader', 'css-loader' ] 79 } 80 ] 81 } 82 } 83 ``` 84 85 **Download** 86 87 See https://csstools.github.io/sanitize.css/latest/sanitize.css 88 89 ## What does it do? 90 91 * Normalizes styles for a wide range of elements. 92 * Corrects bugs and common browser inconsistencies. 93 * Provides common, useful defaults. 94 * Explains what code does using detailed comments. 95 96 ## Browser support 97 98 * Chrome (last 3) 99 * Edge (last 3) 100 * Firefox (last 3) 101 * Firefox ESR 102 * Opera (last 3) 103 * Safari (last 3) 104 * iOS Safari (last 2) 105 * Internet Explorer 9+ 106 107 ## Differences 108 109 [normalize.css] and [sanitize.css] correct browser bugs while carefully testing 110 and documenting changes. normalize.css styles adhere to css specifications. 111 sanitize.css styles adhere to common developer expectations and preferences. 112 [reset.css] unstyles all elements. Both sanitize.css and normalize.css are 113 maintained in sync. 114 115 ## Features 116 117 ##### Box sizing defaults to border-box 118 119 ```css 120 *, ::before, ::after { 121 box-sizing: border-box; 122 } 123 ``` 124 125 ##### Backgrounds do not repeat by default 126 127 ```css 128 *, ::before, ::after { 129 background-repeat: no-repeat; 130 } 131 ``` 132 133 ##### Pseudo-elements inherit text decoration and vertical alignment 134 135 ```css 136 ::before, 137 ::after { 138 text-decoration: inherit; 139 vertical-align: inherit; 140 } 141 ``` 142 143 ##### Cursors only change to hint non-obvious interfaces 144 145 ```css 146 html { 147 cursor: default; 148 } 149 ``` 150 151 ##### Text has a comfortable line height in all browsers 152 153 ```css 154 html { 155 line-height: 1.5; 156 } 157 ``` 158 159 ##### Tabs appear the same on the web as in a typical editor 160 161 ```css 162 html { 163 tab-size: 4; 164 } 165 ``` 166 167 ##### Words break to prevent overflow 168 169 ```css 170 html { 171 word-break: break-all; 172 } 173 ``` 174 175 ##### Documents do not use a margin for outer padding 176 177 ```css 178 body { 179 margin: 0; 180 } 181 ``` 182 183 ##### Navigation lists do not include a marker style 184 185 ```css 186 nav ol, nav ul { 187 list-style: none; 188 padding: 0; 189 } 190 ``` 191 192 ##### Media elements align to the text center of other content 193 194 ```css 195 audio, canvas, iframe, img, svg, video { 196 vertical-align: middle; 197 } 198 ``` 199 200 ##### SVGs fallback to the current text color 201 202 ```css 203 svg:not([fill]) { 204 fill: currentColor; 205 } 206 ``` 207 208 ##### Tables do not include additional border spacing 209 210 ```css 211 table { 212 border-collapse: collapse; 213 } 214 ``` 215 216 ##### Textareas only resize vertically by default 217 218 ```css 219 textarea { 220 resize: vertical; 221 } 222 ``` 223 224 ##### Single taps are dispatched immediately on clickable elements 225 226 ```css 227 a, area, button, input, label, select, summary, textarea, [tabindex] { 228 -ms-touch-action: manipulation; 229 touch-action: manipulation; 230 } 231 ``` 232 233 ##### ARIA roles include visual cursor hints 234 235 ```css 236 [aria-busy="true"] { 237 cursor: progress; 238 } 239 240 [aria-controls] { 241 cursor: pointer; 242 } 243 244 [aria-disabled="true"], [disabled] { 245 cursor: default; 246 } 247 ``` 248 249 ##### Visually hidden content remains accessible 250 251 ```css 252 [aria-hidden="false"][hidden] { 253 display: initial; 254 } 255 256 [aria-hidden="false"][hidden]:not(:focus) { 257 clip: rect(0, 0, 0, 0); 258 position: absolute; 259 } 260 ``` 261 262 --- 263 264 ## Forms 265 266 [sanitize.css] includes a separate stylesheet for normalizing forms using 267 minimal, standards-like styling. 268 269 ```html 270 <link href="https://unpkg.com/sanitize.css" rel="stylesheet" /> 271 <link href="https://unpkg.com/sanitize.css/forms.css" rel="stylesheet" /> 272 ``` 273 274 ### Forms Features 275 276 ##### Form controls appear visually consistent and restyle consistently 277 278 ```css 279 button, input, select, textarea { 280 background-color: transparent; 281 border: 1px solid WindowFrame; 282 color: inherit; 283 font: inherit; 284 letter-spacing: inherit; 285 padding: 0.25em 0.375em; 286 } 287 ``` 288 289 ##### Expandable select controls appear visually consistent 290 291 ```css 292 select { 293 -moz-appearance: none; 294 -webkit-appearance: none; 295 background: no-repeat right center / 1em; 296 border-radius: 0; 297 padding-right: 1em; 298 } 299 300 select:not([multiple]):not([size]) { 301 background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='4'%3E%3Cpath d='M4 0h6L7 4'/%3E%3C/svg%3E"); 302 } 303 304 ::-ms-expand { 305 display: none; 306 } 307 ``` 308 309 ##### Placeholders appear visually consistent in Internet Explorer 310 311 ```css 312 :-ms-input-placeholder { 313 color: rgba(0, 0, 0, 0.54); 314 } 315 ``` 316 317 ## Typography 318 319 [sanitize.css] includes a separate stylesheet for normalizing typography using 320 system interface fonts. 321 322 ```html 323 <link href="https://unpkg.com/sanitize.css" rel="stylesheet" /> 324 <link href="https://unpkg.com/sanitize.css/typography.css" rel="stylesheet" /> 325 ``` 326 327 ### Typography Features 328 329 ##### Typography uses the default system font 330 331 ```css 332 html { 333 font-family: 334 system-ui, 335 /* macOS 10.11-10.12 */ -apple-system, 336 /* Windows 6+ */ Segoe UI, 337 /* Android 4+ */ Roboto, 338 /* Ubuntu 10.10+ */ Ubuntu, 339 /* Gnome 3+ */ Cantarell, 340 /* KDE Plasma 5+ */ Noto Sans, 341 /* fallback */ sans-serif, 342 /* macOS emoji */ "Apple Color Emoji", 343 /* Windows emoji */ "Segoe UI Emoji", 344 /* Windows emoji */ "Segoe UI Symbol", 345 /* Linux emoji */ "Noto Color Emoji"; 346 } 347 ``` 348 349 ##### Pre-formatted and code-formatted text uses the monospace system font 350 351 ```css 352 code, kbd, pre, samp { 353 font-family: 354 /* macOS 10.10+ */ Menlo, 355 /* Windows 6+ */ Consolas, 356 /* Android 4+ */ Roboto Mono, 357 /* Ubuntu 10.10+ */ Ubuntu Monospace, 358 /* KDE Plasma 5+ */ Noto Mono, 359 /* KDE Plasma 4+ */ Oxygen Mono, 360 /* Linux/OpenOffice fallback */ Liberation Mono, 361 /* fallback */ monospace; 362 } 363 ``` 364 365 ## Contributing 366 367 Please read the [contribution guidelines](CONTRIBUTING.md) in order to make the 368 contribution process easy and effective for everyone involved. 369 370 ## Acknowledgements 371 372 sanitize.css is a project by [Jonathan Neal](https://github.com/jonathantneal), 373 built upon normalize.css, a project by 374 [Jonathan Neal](https://github.com/jonathantneal), 375 co-created with [Nicolas Gallagher](https://github.com/necolas). 376 377 [normalize.css]: https://github.com/csstools/normalize.css 378 [reset.css]: http://meyerweb.com/eric/tools/css/reset/ 379 [sanitize.css]: https://github.com/csstools/sanitize.css