Skip to content

lumenpearson/css-normalize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modern Normalisation of CSS-styles.

/**
  Normalising the box model
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/**
  Removing left padding for list tags with a class attribute
 */
:where(ul, ol):where([class]) {
  padding-left: 0;
}

/**
  Removing external margins for body and two other tags with a class attribute
 */
body,
:where(blockquote, figure):where([class]) {
  margin: 0;
}

/**
  Removing vertical external margins for specific tags with a class attribute
 */
:where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  ul,
  ol,
  dl
):where([class]) {
  margin-block: 0;
}

:where(dd[class]) {
  margin-left: 0;
}

:where(fieldset[class]) {
  margin-left: 0;
  padding: 0;
  border: none;
}

/**
  Removing the default marker for an unordered list with a class attribute
 */
:where(ul[class]) {
  list-style: none;
}

/**
  Resetting vertical external margin for a paragraph,
  declaring a local variable for the bottom margin
  to avoid interference with a more complex selector
 */
p {
  --paragraphMarginBottom: 24px;

  margin-block: 0;
}

/**
  Bottom external margin for a paragraph without a class attribute,
  positioned not as the last among its adjacent elements
 */
p:where(:not([class]):not(:last-child)) {
  margin-bottom: var(--paragraphMarginBottom);
}

/**
  Simplifying working with images
 */
img {
  display: block;
  max-width: 100%;
}

/**
  Inheriting font properties for input fields
 */
input,
textarea,
select,
button {
  font: inherit;
}

html {
  /**
    Useful in most situations
    (e.g., when needing to "stick" the footer to the bottom of the site)
   */
  height: 100%;
  /**
    Smooth scroll
   */
  scroll-behaviour: smooth;
}

body {
  /**
    Useful in most situations
    (e.g., when needing to "stick" the footer to the bottom of the site)
   */
  min-height: 100%;
  /**
    Unified line height
   */
  line-height: 1.5;
}

/**
  Standardising the color for svg elements
 */
svg *[fill] { fill: currentColor }
svg *[stroke] { stroke: currentColor }

/**
  Fixing the color change delay bug when interacting with svg elements
 */
svg * {
  transition-property: fill, stroke;
}

/**
  Removing all animations and transitions for users
  who prefer not to use them
 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

About

Modern normalisation of css-styles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 100.0%
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy