18/18 Подбор размеров мне претит, помогите

Подобрал размеры у даты, с помощью паддинга и уменьшения высоты(цифры не кратны 5, что не радует)
Подобрал расположение иконки комментов (left: 152;)
Помогите сделать это изящнее, тем более дату и цитатку можно было через запятую написать, если бы не проблема.
html,
body {
margin: 0;
padding: 0;
}

body {
    width: 280px;
    min-height: 250px;
    padding-top: 50px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 12px;
    font-family: "Arial", sans-serif;
    line-height: 1.2;
    color: #7f8c8d;
    background: #ecf0f1;
}

.post {
    position: relative;
    margin-left: 75px;
}

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

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

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

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

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

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

.icon {
    position: absolute;
    background: url(/assets/course14/post-challenge.png) no-repeat;
}

.icon-tags {
    left: 0;
    background-position: 0 0;
}

.icon-comments {

    left: 152px;
    background-position: -20px 0;
}

.post-text {

    background: #ffffff;
    padding: 10px 15px;
    border-bottom: 5px solid #bdc3c7;
    margin-right: 10px;
}

.post-stats .icon {
    width: 15px;
    height: 15px;
}

Относительно чего вы позиционируете иконки внутри .post-stats?

Относительно первой буквы И в слове “Интенсив”, я весь пост сдвинул на 75px вправо поставил относительное позиционирование и от-но родителя и двигал иконки .post-stats, точно также, как и двигал левые две(date, type). Получается, что от-но блока post.

А может будет лучше относительно .post-stats?

1 лайк

Зачем?

<!DOCTYPE html>
<html lang="ru">
    <head>
        <meta charset="utf-8">
        <title>Испытание: анонс поста</title>
    </head>
    <body>
        <div class="post">
            <div class="post-title">Интенсив: программа</div>
            <div class="post-date">13.09</div>
            <div class="post-type"></div>
            <div class="post-author">
                Автор: <a href="#">HTML Academy</a>
            </div>
            <div class="post-stats">
                <div class="icon icon-tags"></div>
                <a href="#">интенсив</a>,
                <a href="#">программа</a>
            </div>
            <div class="post-stats">
                <div class="icon icon-comments"></div>
                <a href="#">5</a>
            </div>
            <div class="post-text">Работа над интенсивом идёт полным ходом. Мы нашли крутых людей в команду и решили еще кучу задач. Но сегодня я подробнее расскажу о работе над программой интенсива.</div>
        </div>
    </body>
</html>

Координаты будут другие.

Ахахаха, спасибо. Я просто уже за ночь почти забыл, как там всё располагалось. Работает. Единственное, что немного удивило, что отступы не надо вести. Я поставил .post-stats относительное позиционирование и они сами встали. Пойду почитаю как раз про позиционирование, когда relative в relative как они себя ведут.

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

body {
    width: 280px;
    min-height: 250px;
    padding-top: 50px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 12px;
    font-family: "Arial", sans-serif;
    line-height: 1.2;
    color: #7f8c8d;
    background: #ecf0f1;
}

.post {
    position: relative;
    margin-left: 75px;
}

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

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

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

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

.post-stats {
    /* туц */ position: relative; ./* туц */
    display: inline-block;
    padding-left: 20px;
    padding-top: 5px;
    padding-right: 10px;
}

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

.icon {
    position: absolute;
    background: url(/assets/course14/post-challenge.png) no-repeat;
}

.icon-tags {
    left: 0;
    background-position: 0 0;
}

.icon-comments {

    /* туц */ left: 0; /* туц */
    background-position: -20px 0;
}

.post-text {

    background: #ffffff;
    padding: 10px 15px;
    border-bottom: 5px solid #bdc3c7;
    margin-right: 10px;
}

.post-stats .icon {
    width: 15px;
    height: 15px;
}