Испытание: анонс поста 18/18. Блок post-text съехал на 1 пискель

Здравствуйте.
Проходил испытание, согласно уссловию - не трогая HTML-код, и делая все отступы кратными 5.

Получилось, что блок post-text съехал на 1 пискель вниз. Использовать марджин “-1px” - это читерство. Что где исправить?

И в целом, хочется оценки кода:

html,
body {
margin: 0;
padding: 0;
}

body {
width: 280px;
min-height: 250px;
padding-left: 0px;
padding-right: 10px;
font-size: 12px;
font-family: “Arial”, sans-serif;
line-height: 1.2;
color: #7f8c8d;
}

.post {
position: relative;
width: 280px;
min-height: 250px;
padding-left: 85px;
padding-top: 50px;
background: #ecf0f1;
}

.post-date {
position: absolute;
left: 10px;
top: 50px;
text-align: center;
vertical-align: middle;
line-height: 55px;
height: 55px;
width: 55px;
color: #7f8c8d;
background: #ffffff;
font-weight: bold;
font-size: 15px;
border-bottom: #bdc3c7 solid 5px;
}

.post-type {
position: absolute;
left: 10px;
top: 120px;
height: 55px;
width:55px;
background: #7f8c8d url("/assets/course14/quotes.png") no-repeat 50% 50%;
border-bottom: #bdc3c7 solid 5px;
}

.post-title {
color: #2980b9;
font-size: 20px;
}

.post-author {
margin-top: 5px;
}

.post a {
text-decoration: none;
color: #2980b9;
}

.post-stats {
display: inline-block;
margin-right: 10px;
margin-top: 5px;
}

.post-stats .icon {
display: inline-block;
width: 15px;
height: 15px;
float:left;
margin-right: 5px;
}

.post-stats .icon-tags {
background: url("/assets/course14/post-challenge.png") no-repeat 0 0;
}

.post-stats .icon-comments {
background: url("/assets/course14/post-challenge.png") no-repeat -20px 0px;
}

.post-text {
padding: 10px 15px;
padding-top: 10px;
background: #ffffff;
width: 165px;
border-bottom: #bdc3c7 solid 5px;
}

Здесь position: absolute;

Спасибо!
Ещё пришлось добавить

.post-stats {
display: inline-block;
padding-left: 20px;
margin-right: 10px;
margin-top: 5px;
}

.post-stats .icon {
display: inline-block;
width: 15px;
height: 15px;
position: absolute;
margin-left: -20px;
}

А это точно необходимо?

если не сделать, то иконки съедут вправо из-за .post-stats { padding-left: 20px;}

ну можно по другому

.post-stats {
display: inline-block;
position: relative;
padding-left: 20px;
margin-right: 10px;
margin-top: 5px;
}

.post-stats .icon {
display: inline-block;
width: 15px;
height: 15px;
position: absolute;
left: 0;
}

но это две строчки кода вместо одной

или я что-то упускаю?

Это две правильные строчки. Отрицательные отступы без особой надобности - это плохо.

Т[quote=“Ineska, post:6, topic:4854”]
Это две правильные строчки. Отрицательные отступы без особой надобности - это плохо.
[/quote]

То есть отрицательные отступы - признак плохого стиля? Спасибо, буду знать )

1 лайк