Internet Explorer |
Chrome |
Opera |
Safari |
Firefox |
Android |
iOS |
6.0+ |
8.0+ |
1.0+ |
3.5+ |
1.0+ |
1.0+ |
1.0+ |
1.0+ |
Краткая информация
Версии CSS
CSS 1 |
CSS 2 |
CSS 2.1 |
CSS 3 |
|
|
|
|
Описание
Устанавливает значение поля от верхнего края содержимого элемента. Полем называется расстояние от внутреннего края рамки элемента до воображаемого прямоугольника, ограничивающего его содержимое (рис. 1).

Рис. 1. Поле сверху от текста
Синтаксис
padding-top: значение | inherit
Значения
Величину верхнего поля можно указывать в пикселах (px), процентах (%) или других допустимых для CSS единицах. Значение inherit указывает, что оно наследуется у родителя. При указании поля в процентах, значение считается от ширины родителя элемента.
Пример
HTML5CSS2.1IECrOpSaFx
<!DOCTYPE html>
<html>
<head>
<meta charset=»utf-8″>
<title>padding-top</title>
<style>
.layer {
background: #fc3; /* Цвет фона */
border-top: 5px solid #000; /* Параметры верхней линии */
border-bottom: 5px solid #000; /* Параметры нижней линии */
padding: 5px; /* Поля вокруг текста */
padding-top: 10%; /* Поле сверху */
padding-bottom: 10%; /* Поле снизу */
}
</style>
</head>
<body>
<div class=»layer»>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh
euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim
ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl
ut aliquip ex ea commodo consequat.
</div>
</body>
</html>
Результат данного примера показан на рис. 2.

Рис. 2. Применение свойства padding-top
Объектная модель
[window.]document.getElementById(«elementID»).style.paddingTop
Браузеры
Internet Explorer до версии 7.0 включительно не поддерживает значение inherit.
Flawming
0 / 0 / 0
Регистрация: 27.11.2015
Сообщений: 23
|
|
1
|
09.12.2015, 19:04. Просмотров 1055. Ответов 3
Метки нет (Все метки)
Такая проблема когда добавляю второй блок контента по непонятным причинам появляется свободное место между контентом и футером, и полосы прокрутки как избавиться, помогите=)
CSS |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
font-size: 15px;
color: #666666;
font-family: Arrial Narrow, sans-serif;
}
.page-wrap {
min-height: 100%;
margin-bottom: -76px;
}
.page-wrap:after {
content: «»;
display: block;
}
.site-footer, .page-wrap:after {
height: 76px;
}
.header {
width:100%;
height: 120px;
background: #eff3f7;
}
.container_header{
width:1600px;
height:120px;
margin: 0 auto;
}
.logo{
margin-left: 220px;
margin-top: 39px;
}
.logo_vk {
margin-top: 36px;
margin-left: 450px;
}
.logo_vk:hover {
opacity:0.5;
transition: all 1s ease;
}
.logo_tw {
margin-top: 36px;
margin-left: 20px;
}
.logo_tw:hover{
opacity:0.5;
transition: all 1s ease;
}
.logo_fb {
margin-top: 36px;
margin-left: 20px;
}
.logo_fb:hover{
opacity:0.5;
transition: all 1s ease;
}
.logo_git{
margin-top: 36px;
margin-left: 20px;
}
.logo_git:hover{
opacity:0.5;
transition: all 1s ease;
}
.main-menu{
list-style:none;
padding:0;
margin:0;
background-color: #eff3f7;
width:250px;
height:230px;
margin-top:37px;
margin-left:220px;
border-radius: 10px;
font-size: 20px;
}
.main-menu li{
margin:0;
padding:0;
}
.main-menu a{
padding:25px 20px;
display: block;
text-decoration: none;
}
.first a {
background-color: #00acc0;
color:white;
border-radius: 10px 10px 0 0 ;
}
.second a {
color:#00acc0;
}
.third a {
color: #808080;
}
.main-content {
width:100%;
margin-bottom:40px;
}
.container {
width:1600px;
margin:0 auto;
height:auto;
}
.content_container{
margin-left: 550px;
width: 650px;
background-color:#eff3f7;
margin-top:-230px;
margin-bottom: 250px;
}
.container_title{
width:auto;
padding:15px;
border-bottom: 2px solid #00acc0;
color:#00acc0;
display: inline-block;
font-size: 30px;
}
.container_body{
padding: 20px 10px;
}
.container_body_image, .container_body_text{
display:inline-block;
margin-bottom: 10px;
padding:8px;
vertical-align: top;
}
.container_body_image{
width:20%;
text-align: right;
}
.container_body_text{
width:78%;
text-align: left;
}
.site-footer {
width:100%;
background:#eff3f7;;
}
.container_footer{
display: inline-block;
margin-top: 20px;
margin-left:600px;
} |
|
HTML5 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<html>
<head>
<meta http-equiv=»content-type» content=»text/html»; charset=»utf-8″>
<meta http-equiv=»X-UA-Compatible» content=»IE-Edge»>
<title>LoftSchool</title>
<link rel=»stylesheet» href=»css/style.css» type=»text/css»>
<link rel=»stylesheet» href=»http://fonts.googleapis.com/css?family=Oswald:400,300″ type=»text/css»>
<!—[if lt IE 9]>
<script src=»http://html5shiv.googlecode.com/svn/trunk/html5.js»></script>
<![endif]—>
</head>
<body>
<div class=»page-wrap»>
<header class=»header»>
<div class=»container_header»>
<img src=»img/logo_header.png» alt=»LoftSchool logo» class=»logo»>
<img src=»img/vk_header.png» alt=»vk» class=»logo_vk»>
<img src=»img/tw_header_1.png» alt=»tw» class=»logo_tw»>
<img src=»img/fb_header_1.png» alt=»fb» class=»logo_fb»>
<img src=»img/git_header_1.png» alt=»git» class=»logo_git»>
</div>
</header>
<div class=»main-content»>
<div class=»container»>
<nav>
<ul class=»main-menu»>
<li class=»first»><a href=»#»>Обо мне</a></li>
<li class=»second»><a href=»#»>Мои работы</a></li>
<hr color=»#00acc0″>
<li class=»third»><a href=»#»>Связаться со мной</a></li>
</ul>
</nav>
<div class=»content_container»>
<div class=»container_title»>Опыт работы</div>
<div class=»container_body clearfix»>
<div class=»container_body_image»>
<img src=»img/block_2.png» alt=»block»>
</div>
<div class=»container_body_text»>
<p>»ИП Боровицкий»- Продавец дисков<br>
Сентябрь 2005-Август 2008</p></div>
<div class=»container_body_image»>
<img src=»img/block_2.png» alt=»block»>
</div>
<div class=»container_body_text»>
<p>»ООО Системы безопастности»- Системный администратор<br>
Июнь 2008-Июль 20010</p>
</div>
</div>
</div>
<div class=»content_container»>
<div class=»container_title»>Образование</div>
<div class=»container_body clearfix»>
<div class=»container_body_image»>
<img src=»img/stady.png» alt=»tw»>
</div>
<div class=»container_body_text»>
<p>Незаконченное высшее.СПБГУ ИТМО<br>
Окстябрь 2020 — по настоящее время</p></div>
<div class=»container_body_image»>
<img src=»img/kurs.png» alt=»vk»>
</div>
<div class=»container_body_text»>
<p>Курсы Loftschool.ru<br>
Ноябрь 2020 — по настоящее время</p>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class=»site-footer»>
<div class=»container_footer»>
<p class=»word»> ©Это мой сайт, пожалуйста, не копируйте и не воруйте его.</p>
</div>
</footer>
</body>
</html> |
|
Миниатюры
|