CSS

Igor4.11.2023
Image showing CSS code

CSS is the language that defines how web content is presented and styled, making it a vital component of modern web development. With CSS, developers can control layout, colors, fonts, and other design elements.

css/* Reset default browser style */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Defining custom properties */
:root {
  --some-name: hsla(25, 50%, 70%, 0.8);
  --some-other-name: #f7f7f7;
}

/* Responsive image */
img {
  max-width: 100%;
}

/* Button */
button {
  background: var(--some-name);
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-radius: 4px;
  color: var(--some-other-name);
  display: flex;
  line-height: 1.5;
  margin: 0;
  padding: .5em 1em;
  min-width: 3.5rem;
  height: 3rem;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  max-height: 40px;
  transition: var(--transition-all);
  justify-content: space-evenly;
  align-items: center;
  text-transform: capitalize;
}

/* If element with .one-class has an element with class .second-class after,
and second element contains an element with .btn-class,
do something with the button in element .one-class */
.one-class:has(+ .second-class .btn-class) button[data-some-id] {
  display: flex;
}

/* Masonry grid layout */
.masonry-grid-container {
  display: grid;
  grid-gap: 5px;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  grid-auto-rows: 75px;
  grid-auto-flow: dense;
}
.horizontal {
  grid-column: span 2;
}
.vertical {
  grid-row: span 2;
}
.big {
  grid-column: span 2;
  grid-row: span 2;
}
/* END */