Базовая производительность графики на iOS

CSS flexbox может сделать это с justify-content: center в родительском элементе изображения.

HTML

CSS

.image-container {
  display: flex;
  justify-content: center;
}

Выход:

body {
  background: lightgray;
}
.image-container {
  width: 200px;
  display: flex;
  justify-content: center;
  margin: 10px;
  padding: 10px;
  /* Material design properties */
  background: #fff;
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.image-2 {
  width: 500px;
}
.image-3 {
  width: 300px;
}

30
задан Cœur 6 October 2018 в 18:22
поделиться