Испытание 19/20 Есть ли смысл так складывать пункты?


#1
html,

body {
margin: 0;
padding: 0;
font-family: “Arial”, sans-serif;
line-height: 30px;
}

body {
min-width: 550px;
min-height: 290px;
padding: 10px;
}

.two-cards {
width: 350px;
height: 250px;
padding: 10px;
text-align: center;
}

.two-cards div {
position: relative;
display: inline-block;
width: 120px;
height: 180px;
margin: 0 10px;
margin-top: 30px;
vertical-align: middle;
background-color: white;
border-radius: 5px;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Ширина иконок, не изменяйте */
.two-cards div::before,
.two-cards div::after {
width: 20px;
}

/* Поворот нижней иконки */
.two-cards div::after {
transform: rotate(180deg);
}

.ace-heart,
.ace-heart::after,
.ace-heart::before {
background-image:url("/assets/course57/heart.svg");
}

.two-spade,
.two-spade::after,
.two-spade::before {
background-image:url("/assets/course57/spade.svg");
}

.ace-heart,
.two-spade {
background-repeat:no-repeat;
background-position:50% 50%;
background-size:50px;
}

.ace-heart::before,
.ace-heart::after {
color:red;
content:“A”
}

.two-spade::after,
.two-spade::before {
content:“2”;
}

.ace-heart::before,
.ace-heart::after,
.two-spade::after,
.two-spade::before {
padding-bottom:30px;
font-size:25px;
font-weight:bold;
position:absolute;
background-size:25px;
background-repeat:no-repeat;
background-position:50% 25px;
}

.ace-heart::before,
.two-spade::before{
top:5px;
left:5px
}

.ace-heart::after,
.two-spade::after{
bottom:5px;
right:5px;
}

Максимально сложил вместе повторяющиеся элементы, есть ли в этом смысл, потому что в итоге код стал на 3-4 строчки длиннее?


#2

Мой вариант :face_with_raised_eyebrow:

чудо-код
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Arial", sans-serif;
  line-height: 30px;
}

body {
  min-width: 550px;
  min-height: 290px;
  padding: 10px;
}

.two-cards {
  width: 350px;
  height: 250px;
  padding: 10px;
  text-align: center;
}

.two-cards div {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 180px;
  margin: 0 10px;
  margin-top: 30px;
  vertical-align: middle;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Ширина иконок, не изменяйте */
.two-cards div::before,
.two-cards div::after {
  width: 20px;
}

/* Поворот нижней иконки */
.two-cards div::after {
  transform: rotate(180deg);
}

.ace-heart {
  background-image: url('heart.svg');
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 50px;
}

.ace-heart::before {
  content: 'A';
  position: absolute;
  left: 5px;
  top: 5px;
  height: 50px;
  font-size: 25px;
  color: red;
  font-weight: bold;
  background-image: url('heart.svg');
  background-repeat: no-repeat;
  background-position: 50% 100%;
  background-size: 25px;
}

.ace-heart::after {
  content: 'A';
  position: absolute;
  right: 5px;
  bottom: 5px;
  height: 50px;
  font-size: 25px;
  color: red;
  font-weight: bold;
  background-image: url('heart.svg');
  background-repeat: no-repeat;
  background-position: 50% 100%;
  background-size: 25px;
}

.two-spade {
  background-image: url('spade.svg');
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 50px;
}

.two-spade::before {
  content: '2';
  position: absolute;
  left: 5px;
  top: 5px;
  height: 75px;
  font-size: 25px;
  color: black;
  font-weight: bold;
  background-image: url('spade.svg');
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 25px;
}

.two-spade::after {
  content: '2';
  position: absolute;
  right: 5px;
  bottom: 5px;
  height: 75px;
  font-size: 25px;
  color: black;
  font-weight: bold;
  background-image: url('spade.svg');
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 25px;
}

#3

чисто по программе
ничего не выдумывал
html,
body {
margin: 0;
padding: 0;
font-family: “Arial”, sans-serif;
line-height: 30px;
}

body {
min-width: 550px;
min-height: 290px;
padding: 10px;
}

.two-cards {
width: 350px;
height: 250px;
padding: 10px;
text-align: center;
}

.two-cards div {
position: relative;
display: inline-block;
width: 120px;
height: 180px;
margin: 0 10px;
margin-top: 30px;
vertical-align: middle;
background-color: white;
border-radius: 5px;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Ширина иконок, не изменяйте */
.two-cards div::before,
.two-cards div::after {
width: 20px;
font-size: 25px;
}

/* Поворот нижней иконки */
.two-cards div::after {
transform: rotate(180deg);
}

.ace-heart::before {
content: “A”;
position: absolute;
top: 5px;
left: 5px;
padding-bottom: 20px;
font-size: 25px;
font-weight: bold;
color: red;
background: url(“heart.svg”) no-repeat 50% 100%;
background-size: 25px auto;
}

.ace-heart::after {
content: “A”;
position: absolute;
right: 5px;
bottom: 5px;
padding-bottom: 20px;
font-size: 25px;
font-weight: bold;
color: red;
background: url(“heart.svg”) no-repeat 50% 100%;
background-size: 25px auto;
}

.ace-heart {
position: relative;
width: 160px;
height: 240px;
margin: 0 auto;
margin-top: 30px;
background: url(“heart.svg”) no-repeat 50% 50%;
background-color: white;
background-size: 50px auto;
border-radius: 5px;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.8);
}

.ace-heart::before {
content: “A”;
position: absolute;
top: 5px;
left: 5px;
padding-bottom: 20px;
font-size: 25px;
color: red;
background: url(“heart.svg”) no-repeat 50% 100%;
background-size: 25px auto;
}

.two-spade::before {
content: “2”;
position: absolute;
top: 5px;
left: 5px;
padding-bottom: 20px;
font-size: 25px;
font-weight: bold;
color: black;
background: url(“spade.svg”) no-repeat 50% 100%;
background-size: 25px auto;
}

.two-spade::after {
content: “2”;
position: absolute;
right: 5px;
bottom: 5px;
padding-bottom: 20px;
font-size: 25px;
font-weight: bold;
color: black;
background: url(“spade.svg”) no-repeat 50% 100%;
background-size: 25px auto;
}

.two-spade {
position: relative;
width: 160px;
height: 240px;
margin: 0 auto;
margin-top: 30px;
background: url(“spade.svg”) no-repeat 50% 50%;
background-color: white;
background-size: 50px auto;
border-radius: 5px;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.8);
}


#4

.ace-heart {
position: relative;
width: 160px;
height: 240px;
margin: 0 auto;
mar gin-top: 30px;

background: url(heart.svg) no-repeat 50% 50%;
background-color: white;
background-size: 50px auto;
borde r-radius: 5px;
box-sh adow: 0px 3px 5px rgba(0, 0, 0, 0.8);

}

У .two-spade {…} столько же лишнего.

Всё зачеркнутое перехватывает .two-cards div – у него специфичность выше.