Last updated about 5 days ago

css

Selectors

<selector > {
  <property>: <value>;
}

Pseudo-Classes

<selector>:<pseudo-class> {...}

Pesudo-Elements

<selector>::<pseudo-element> {...}

Combinators

<selector> <combinator> <selector2> {...}

More on Wildcard Selectors

Tips

Sizing Units

Colors

Typography

Box-model

content, padding, border, margin.

Layouts

Flexbox

Grid

Frameworks

Tips n Tricks

Center Div

<div class="outer">This text should be in center!</div>

<style>
  .outer {
    display: flex /* grid */;
    justify-content: center;
    align-items: center;
    height: 100%;
  }
</style>

Change svg color using css filter

Source

  1. Add the SVG image using an <img> tag.

    <img src="dotted-arrow.svg" class="filter-green" />
  2. To filter to a specific color, use the following Codepen to convert a hex color code to a CSS filter:

For example, output for #00EE00 is

filter: invert(42%) sepia(93%) saturate(1352%) hue-rotate(87deg) brightness(119%) contrast(119%);

  1. Add the CSS filter into this class.

    .filter-green {
      filter: invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg)
        brightness(118%) contrast(119%);
    }

Center a position: fixed element

position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);