i4kain
07.Октябрь.2016 13:52:37
1
100% получил. Просьба высказать замечания по коду, если таковые имеются.
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 {
position: absolute;
top: 0;
left: 0;
width: 15px;
height: 15px;
background: url("/assets/course14/post-challenge.png") no-repeat 0 0;
}
.post {
position: relative;
padding-left: 75px;
}
.post-title {
font-size: 20px;
color: #2980b9;
}
.post-date {
position: absolute;
top: 0px;
left: 0px;
width: 55px;
height: 55px;
background: #ffffff;
border-bottom: 5px solid #bdc3c7;
font-size: 15px;
font-weight: bold;
text-align: center;
line-height: 55px;
vertical-align: middle;
}
.post-type {
position: absolute;
top: 70px;
left: 0px;
width: 55px;
height: 55px;
background: #7f8c8d url("/assets/course14/quotes.png") no-repeat 50% 50%;
border-bottom: 5px solid #bdc3c7;
}
.post-author {
margin: 5px 0;
}
.post a{
color: #2980b9;
text-decoration: none;
}
.post-stats {
display: inline-block;
position: relative;
padding-left: 20px;
margin-right: 10px;
}
.post-stats .icon-comments {
background-position: -20px 0;
}
.post-text {
padding: 10px 15px;
background-color: #ffffff;
border-bottom: 5px solid #bdc3c7;
margin-right: 10px;
}
Ineska
07.Октябрь.2016 15:41:18
2
Проверьте, нужно ли выделенное свойство здесь. А еще можно сгруппировать общие свойства у .post-date и .post-type. А так код очень хороший.
а не проще ли классу icon вместо position: absolute присвоить значение float: left? все встанет в одну строку и все
Ineska
22.Октябрь.2016 16:52:14
5
Интересная идея. Попробуйте и опубликуйте код здесь.
впишите текст сюда; также, отключить форматирование текста можно, начав строку с четырех пробелов`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;
padding: 0;
margin: 0;
width: 300px;
margin-left: 75px;
}
.post a {
text-decoration: none;
color: #2980b9 ;
}
.post-title {
color: #2980b9 ;
font-size: 20px;
margin-bottom: 5px;
}
.post-text {
width: 165px;
height: 108px;
padding-top: 10px;
padding-bottom: -1px;
padding-left: 15px;
padding-right: 15px;
background-color: #ffffff ;
border-bottom: 5px solid #bdc3c7 ;
margin-top: -6px;
}
.post-date {
position: absolute;
width: 55px;
height: 55px;
top: 0px;
left: -75px;
background-color: #ffffff ;
vertical-align: middle;
line-height: 55px;
font-size: 15px;
font-weight: bold;
text-align: center;
border-bottom: 5px solid #bdc3c7 ;
}
.post-type {
position: absolute;
width: 55px;
height: 55px;
border-bottom: 5px solid #bdc3c7 ;
top: 70px;
left: -75px;
text-align: center;
vertical-align: middle;
background: #7f8c8d url("/assets/course14/quotes.png") no-repeat;
background-position: 50% 50%;
}
.post-stats {
display: inline-block;
margin-right: 10px;
margin-bottom: 0px;
padding: 0;
}
.post-stats .icon {
float: left;
width: 15px;
height: 15px;
margin-right: 5px;
margin-bottom: 0px;
}
.post-stats .icon-tags {
background: url("/assets/course14/post-challenge.png") no-repeat;
background-position: 0 0;
}
.post-stats .icon-comments {
background: url("/assets/course14/post-challenge.png") no-repeat;
background-position: -20px 0;
}
.post-author {
padding-bottom: 0px;
margin-bottom: 5px;
}
.post-stats {
padding: 0px;
margin-top: 0px;
margin-bottom: 5px;
})`
код разместил. посмотрите интересно ваше мнение
Ineska
22.Октябрь.2016 17:31:13
8
К float: left; у меня вопросов нет.
Но есть другие интересные вещи:
Отрицательных отступов и координат быть не должно. Размеры всех значений кратны пяти.
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;
padding: 0;
margin: 0;
width: 300px;
padding-left: 75px;
}
.post a {
text-decoration: none;
color: #2980b9 ;
}
.post-title {
color: #2980b9 ;
font-size: 20px;
margin-bottom: 5px;
}
.post-text {
width: 165px;
height: 95px;
padding: 10px 15px;
background-color: #ffffff ;
border-bottom: 5px solid #bdc3c7 ;
}
.post-date {
position: absolute;
width: 55px;
height: 55px;
top: 0px;
left: 0px;
background-color: #ffffff ;
vertical-align: middle;
line-height: 55px;
font-size: 15px;
font-weight: bold;
text-align: center;
border-bottom: 5px solid #bdc3c7 ;
}
.post-type {
position: absolute;
width: 55px;
height: 55px;
border-bottom: 5px solid #bdc3c7 ;
top: 70px;
left: 0px;
text-align: center;
vertical-align: middle;
background: #7f8c8d url("/assets/course14/quotes.png") no-repeat;
background-position: 50% 50%;
}
.post-stats {
display: inline-block;
margin-right: 10px;
}
.post-stats .icon {
float: left;
width: 15px;
height: 15px;
margin-right: 5px;
}
.post-stats .icon-tags {
background: url("/assets/course14/post-challenge.png") no-repeat;
background-position: 0 0;
}
.post-stats .icon-comments {
background: url("/assets/course14/post-challenge.png") no-repeat;
background-position: -20px 0;
}
.post-author {
margin-bottom: 5px;
}
вроде как все поправил но не сходится блок с классом post-text примерно в 1px. не пойму в чем причина
Ineska
22.Октябрь.2016 18:42:58
10
Попробуйте убрать высоту для этого блока.
все равно не верно. может ли это быть из-за того что я сделал float вместо position?
меняю .post-stats на inline и блок с текстом становится на место
Ineska
22.Октябрь.2016 18:54:42
13
Да, из-за флоата… Неожиданно. Если для .post-stats выставить height: 14px; то всё правильно. А так поскольку высота иконки 15px, то появляется лишний пиксель…