[18/18] 92% - как подвинуть иконки тегов?

Здравствуйте, подскажите где неточность - визуально результат практически идентичен.
Только иконки тегов не встают вплотную к блоку с текстом внизу. И оцените общую чистоту кода. Спасибо.

    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;
}

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

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

.post-date {
    position: absolute;
    top: 50px;
    width: 55px;
    height: 35px;
    color: #7f8c8d;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    padding-top: 20px;
    background-color: #fff;
    border-bottom: 5px solid #bdc3c7;
}

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

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

.post-stats {
    display: inline-block;
}

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

.icon-tags {
    margin-left: 75px;
    background: url('/assets/course14/post-challenge.png') no-repeat 0px 0px;
}

.icon-comments {
    margin-left: 10px;
    background: url('/assets/course14/post-challenge.png') no-repeat -20px 0px;
}

.post-text {
    width: 175px;
    height: 100px;
    margin-left: 75px;
    background: #fff;
    padding: 10px;
    border-bottom: 5px solid #bdc3c7;
}

Не надо задавать иконкам блочно-строчный тип. Именно по этой причине у вас не получается выровнять их.
Дата в блоке .post-date выравнивается с помощью line-height.

Сменил подход, почти получилось. :slight_smile: Только нижний край блока с текстом не совпадает на пару миллиметров.

.post {
    padding-left: 75px;
}

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

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

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

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

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

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

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

.icon-tags {
    background: url('/assets/course14/post-challenge.png') 0px 0px;
}

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

.post-text {
    width: 170px;
    height: 100px;
    background: #fff;
    padding: 10px 10px 10px 15px;
    border-bottom: 5px solid #bdc3c7;
}

не надо прописывать height - ведь количество текста может и измениться

1 лайк

спасибо :slight_smile:

Чтобы отцентровать дату нужно задать элементу:
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 55px;
P.S. Чтобы увидеть vertical-align в действии нам нужно как раз таки установить line-height равным высоте элемента.

Это жесть, какая-то… Чуть голову не сломал…

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-stats .icon {
width: 15px;
height: 15px;
}
.post-title {
color: #2980b9;
font-size: 20px;
margin-left: 75px;
}
.post-date {
width: 55px;
height: 35px;
position: absolute;
top: 50px;
background-color: #ffffff;
font-size: 15px;
border-bottom: 5px solid #bdc3c7;
text-align: center;
vertical-align: middle;
font-weight: bold;
padding-top: 20px;
line-height: 15px;
}
.post-type {
width: 55px;
height: 55px;
position: absolute;
background: #7f8c8d url("/assets/course14/quotes.png") no-repeat 50% 50%;
border-bottom: 5px solid #bdc3c7;
top: 120px;
}
.post-author {
margin-left: 75px;
margin-top: 5px;
}
a {
text-decoration: none;
color: #2980b9;
}
.post-stats {
display: inline-block;
position: relative;
margin-top: 5px;
margin-right: -65px;
margin-left: 95px;
}
.post-stats .icon-tags {
background: url("/assets/course14/post-challenge.png") no-repeat 0 0;
position: absolute;
left: -20px;
}
.post-stats .icon-comments {
background: url("/assets/course14/post-challenge.png") no-repeat -20px 0;
position: absolute;
left: -20px;
}
.post-text {
padding: 10px 15px;
width: 165px;
background: #ffffff;
border-bottom: 5px solid #bdc3c7;
position: relative;
left: 75px;
}

И что это за “танцы”?
И .post-text вдруг на относительном позиционировании, для оригинальности?

Именно…Для оригинальности… )))
По другому не получалось и вот пришлось станцевать… )))

Оригинально - это не всегда означает правильно. Танцуйте в сторону стандартной блочной модели)