Git Product home page Git Product logo

css-normalize's Introduction

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;
  }
}

css-normalize's People

Contributors

aleksanderlamkov avatar lumenpearson avatar

Stargazers

 avatar Leather avatar Déjà Vu Polakian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.