Форум программистов, компьютерный форум, киберфорум
HTML, CSS
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.83/6: Рейтинг темы: голосов - 6, средняя оценка - 4.83
0 / 0 / 0
Регистрация: 14.11.2018
Сообщений: 16

Не растягивается внутренний div контейнер

20.11.2018, 23:23. Показов 1222. Ответов 1
Метки css, div, htm (Все метки)

Студворк — интернет-сервис помощи студентам
Вечер добрый,
Знающие люди подскажите почему не растягивается мой внутренний контейнер и не применяются классы red, orange...

INDEX.HTML
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
<!DOCTYPE html>
<html>
<head>
    <title>Mastermind</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
    <div class="header">
    Parametrage de la partie
    </div>
         
    <div class="navigation">
    Nombre de tours: <input type="text" />
    </div>
    
    <div class="navigation1">
    Jeu
    </div>
    
    <div class="content">
        <div class="flex-container ">
            <div class="red" ></div>
            <div class="orange"></div>
            <div class="blue"></div>
            <div class="yellow"></div>
            <div class="orange"></div>
            <div class="violet"></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
        </div>
        
    </div>
    
    <div class="sidebar">
    <div>1</div>
    </div>
         
    
         
    <div class="clear">
    </div>
                               
    <div class="footer">
     <a href="#" class="but">Reccomancer la partie</a>
    </div>
</div>
</body>
</html>
STYLE.CSS
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
body {
    height:100%;
     background: #FFF;
     /*
     font-size: 14px;
     color: #000;
     */
     font-family: Arial, sans-serif;
     text-shadow: -1px -1px 0 hsl(80, 70%, 35%),
     -2px -2px 1px hsl(80, 70%, 35%);
}
 
div {
    border-radius: 5px;
}
 
.header {
     background: #F5DEB3;
     width: 100%;
     height: 25px;
}
 
.container {
    /*
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    */
    
     margin: auto;
     text-align: center;
     width: 32%;
     height: 100%;
     clear: both; 
    
    
    
}
 
.navigation {
     background: #FE9798;
     width: 100%;
     height: 25px;
     border-bottom: none;
}
 
.navigation1 {
     background: #ff0000;
     width: 100%;
     height: 25px;
}
 
.content {
     background: #40E0D0;
     float: left;
     width: 80%;
     height: 280px;
}
 
.sidebar {
     background: #DCDCDC;
     float: right;
     width: 20%;
     height: 280px;
}
 
.clear {
     clear: both;
}
 
.footer {
    background: red;
    width: 100%;
    height: 40px;
    padding: 30px 0px 0px 0px;
    border-bottom: none;
}
 
.box div {
    border: 3px solid black;
    width:40px;
    height: 40px;
}
 
.red {
    background: #ffffff;
}
.orange {
    background: orange;
}
.blue {
    background: blue;
}
.yellow {
    background: yellow;
}
.violet {
    background: violet;
}
.box  {
     display: -webkit-flex; 
    -webkit-flex-wrap: wrap;
    display: flex;
    flex-wrap: wrap;
}
 
 
a.but {
    color: #fff;
    text-decoration: none;
    user-select: none;
    background: deepskyblue;
    padding: .7% 6%;
    outline: none;
    text-align: center;
    border-radius: 5px;
}
 
 
.flex-container {
  display: flex;
  flex-wrap: wrap;
  background-color: DodgerBlue;
}
 
.flex-container > div {
  background-color: #f1f1f1;
  width: 50px;
  height: 50px;
  margin: 10px;
  text-align: center;
  line-height: 75px;
  font-size: 30px;
}
Добавлено через 1 час 49 минут
Разобрался,
пока пришел вот к такому варианту.
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
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
<!DOCTYPE html>
<html>
<head>
    <title>Mastermind</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1> MasterMind</h1>
<div class="container">
    <div class="header">
    Parametrage de la partie
    </div>
         
    <div class="navigation">
    Nombre de tours: <input type="text" />
    </div>
    
    <div class="navigation1">
    Jeu
    </div>
    
    <div class="content">
        <div class="flex-container ">
        
            <div class="red"></div>
            <div class="orange"></div>
            <div class="blue"></div>
            <div class="yellow"></div>
            <div class="orange"></div>
            <div class="violet"></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
    
        </div>
        
    </div>
    
    <div class="sidebar">
    <div>Resultat:</div>
    
        <div class="flex-container_c">
            <div class="circle_r"></div>
            <div class="circle_o"></div>
            <div class="circle_b"></div>
            <div class="circle_y"></div>
            <div class="circle_o"></div>
            <div class="circle_v"></div>
        </div>
        
         <a href="#" class="but">Valide</a>
 
    </div>
         
    
         
    <div class="clear">
         
    </div>
                               
    <div class="footer">
     <a href="#" class="but">Reccomancer la partie</a>
    </div>
</div>
</body>
 
 
 
 
</html>


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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
body {
     height:100%;
     background-image: url("bg.jpg");
     -moz-background-size: 100%; /* Firefox 3.6+ */
    -webkit-background-size: 100%; /* Safari 3.1+ и Chrome 4.0+ */
    -o-background-size: 100%; /* Opera 9.6+ */
    background-size: 100%;
 
     font-family: Arial, sans-serif;
     font-size: 20px;
}
 
div {
    border-radius: 5px;
}
 
.header {
     background: #F5DEB3;
     width: 100%;
     height: 25px;
}
 
.container {
    background-image: url("bd.jpg");
    /*
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    */
    
     margin: auto;
     text-align: center;
     width: 42%;
     height: 100%;
     clear: both; 
    
    
    
}
 
.navigation {
     background: #FE9798;
     width: 100%;
     height: 25px;
     border-bottom: none;
     text-align: left;
}
 
.navigation1 {
     background: #ff0000;
     width: 100%;
     height: 25px;
     text-align: left;
}
 
.content {
     background: #40E0D0;
     float: left;
     width: 62%;
     height: 700px;
}
 
.sidebar {
     background: #DCDCDC;
     float: right;
     width: 38%;
     height: 700px;
 
}
 
.clear {
     clear: both;
}
 
.footer {
    background: red;
    width: 100%;
    height: 30px;
    padding: 15px 0px 0px 0px;
    border-bottom: none;
    
}
 
.box div {
    border: 3px solid black;
    width:40px;
    height: 40px;
}
 
.red:nth-of-type(1) {
    background: red;
}
.orange:nth-of-type(2) {
    background: orange;
}
.blue:nth-of-type(3) {
    background: blue;
}
.yellow:nth-of-type(4) {
    background: yellow;
}
.orange:nth-of-type(5) {
    background: orange;
}
 
.violet:nth-of-type(6) {
    background: violet;
}
 
.circle_r {
    width: 30px;
    height: 30px;
    background: red;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    margin: 3px;
}
 
.circle_o {
    width: 30px;
    height: 30px;
    background: orange;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    margin: 3px;
}
 
.circle_b {
    width: 30px;
    height: 30px;
    background: blue;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    margin: 3px;
}
 
.circle_y {
    width: 30px;
    height: 30px;
    background: yellow;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    margin: 3px;
}
 
.circle_v {
    width: 30px;
    height: 30px;
    background: violet;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    margin: 3px;
}
 
 
.box  {
     display: -webkit-flex; 
    -webkit-flex-wrap: wrap;
    display: flex;
    flex-wrap: wrap;
}
 
 
a.but {
    color: #fff;
    text-decoration: none;
    user-select: none;
    background: deepskyblue;
    padding: .3% 3%;
    outline: none;
    text-align: center;
    border-radius: 5px;
    margin: 10px 10px 10px 10px;
}
 
 
.flex-container {
  display: flex;
  flex-wrap: wrap;
  background-color: DodgerBlue;
}
 
.flex-container > div {
  
  width: 50px;
  height: 50px;
  margin: 10px;
  text-align: center;
  line-height: 75px;
  font-size: 30px;
  
  background: white;
}
 
 
.flex-container_c {
  display: flex;
  flex-wrap: wrap;
  margin: 10px;
}
 
 
H1 {
  overflow: hidden;
  text-shadow: 0 0 #228B22,
               0 0 yellowgreen,
               0 0 skyblue;
  color: transparent;
  transition: all 1s;
  text-align: center;
  }
  H1:hover {
    text-shadow: -400px 0 tomato,
                 400px 0 yellowgreen,
                 0 0 skyblue;
    }
0
Лучшие ответы (1)
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
20.11.2018, 23:23
Ответы с готовыми решениями:

Блок div не растягивается
Здравствуйте. У меня не растягивается блок DIV, и всё лезит за пределы блока. Вот страница с отзывами. Блок отзывов, если нажать...

div не растягивается по высоте
Здравствуйте, знаю что простейший вопрос, но не могу найти информацию как сделать. Фоновое изображение 1024х1280 из макета не растягивается...

background растягивается на соседний div
Вот код: &lt;div style=&quot;float: left; padding: 8px;&quot;&gt; &lt;a href=&quot;messages.php&quot;&gt;Управление сообщениями&lt;/a&gt;&lt;br&gt; &lt;a...

1
Эксперт JSЭксперт HTML/CSS
 Аватар для mrtoxas
3827 / 2677 / 1521
Регистрация: 12.07.2015
Сообщений: 6,672
Записей в блоге: 4
21.11.2018, 01:45
Лучший ответ Сообщение было отмечено RtlSdr как решение

Решение

Цитата Сообщение от RtlSdr Посмотреть сообщение
не применяются классы red
У селектора .flex-container > div{} вес больше, чем у .red{}, поэтому применяется первый.
Читаем про специфичность селекторов.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
21.11.2018, 01:45
Помогаю со студенческими работами здесь

Не правильно растягивается фон, а точнее div
Добрый вечер! Столкнулся с такой проблемой, что при разрешении экрана браузера в 1920 по ширине страница и блоки отображаются нормально, а...

Почему div не растягивается на всю страницу?
Здраствуйте, мне нужно футер разтянуть на всю страницу, когда браузер открыт на весь экран, то всё ок, но когда его сжимаешь(браузер), то...

Не растягивается div.content если содержимое из блоков.
Три дива - шапка, контент, ноги. Шапка с подвалом на слое 2, контент на слое 1, шапка и подвал прикреплены (fixed) сверху и снизу. ...

Div не растягивается по высоте после пополнения контента
Здравствуйте. Помогите решить походу простейшую задачу, над которой ломаю голову уже 2 часа. У меня есть 3 дива (3 колонки) left, center ,...

Внутренний div вплотную к родительскому сверху
Поставил margin на 0, но все равно отступ сверху. Как исправить? https://jsfiddle.net/enra444v/ &lt;div...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Вывод текста со шрифтом TTF с помощью SDL3_ttf
8Observer8 01.02.2026
Содержание блога В этой пошаговой инструкции создадим с нуля веб-приложение, которое выводит текст в окне браузера. Запустим на Android на локальном сервере. Загрузим Release на бесплатный. . .
SDL3 для Web (WebAssembly): Сборка C/C++ проекта из консоли
8Observer8 30.01.2026
Содержание блога Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
SDL3 для Web (WebAssembly): Установка Emscripten SDK (emsdk) и CMake для сборки C и C++ приложений в Wasm
8Observer8 30.01.2026
Содержание блога Для того чтобы скачать Emscripten SDK (emsdk) необходимо сначало скачать и уставить Git: Install for Windows. Следуйте стандартной процедуре установки Git через установщик. . . .
SDL3 для Android: Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 29.01.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
SDL3 для Android: Загрузка PNG с альфа-каналом с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
SDL3 для Android: Загрузка PNG с альфа-каналом с помощью SDL3_image
8Observer8 27.01.2026
Содержание блога SDL3_image - это библиотека для загрузки и работы с изображениями. Эта пошаговая инструкция покажет, как загрузить и вывести на экран смартфона картинку с альфа-каналом, то есть с. . .
Влияние грибов на сукцессию
anaschu 26.01.2026
Бифуркационные изменения массы гриба происходят тогда, когда мы уменьшаем массу компоста в 10 раз, а скорость прироста биомассы уменьшаем в три раза. Скорость прироста биомассы может уменьшаться за. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru