Kaigai Blog living abroad in my twenties

【My Study Note】CSS Codes

CSS Programming

CSS Codes

Selecting the attribute

Attribute全般

[href]{
   color: magenta;
}

特定のAttribute

a[href*='florence'] {
  color: lightgreen;
}

Important

!important can be applied to specific declarations, instead of full rules. It will override any style no matter how specific it is. As a result, it should almost never be used. Once !important is used, it is very hard to override.

p {
  color: blue !important;
}

Position: Sticky

A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport – then it “sticks” in place (like position:fixed).

div.sticky {
  position: -webkit-sticky; /* Safari */
  position: sticky;
  top: 0;
}

Flexbox

Useful Site Link (Japanese)

Useful Links while Coding