Bonjour,

Je souhaite adapter dynamiquement la hauteur d'un conteneur div (id="about-contact") en fonction de son contenu (class="tabs").
J'ai tout essayé en CSS et je n'arrive pas à adapter la hauteur de mon conteneur automatiquement. Que ce soit avec un min-height, un height: auto ou d'autres fonctions.

Je ne sais vraiment pas comment résoudre mon problème. J'ai tenté de résoudre mon problème avec du javascript mais ça n'a rien donné.

dans mon code html voici ma structure :

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<div id="about-contact" class="box2">
<div class="tabs">
 <input id="tab-2" type="radio" name="radio-set" class="tab-selector-2" />
<label for="tab-2" class="tab-label-2">Contact</label>
<input id="tab-1" type="radio" name="radio-set" class="tab-selector-1" checked="checked" />
<label for="tab-1" class="tab-label-1">About</label>
 
 
 
<div class="clear-shadow"></div>
<div class="content">
 
<div class="content-1">
</div>
 
<div class="content-2">
</div>
 
</div>
</div>
</div>

dans mon CSS :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#about-contact{
	background-color: #F5F5F5;
	position: relative;
	min-height: 200px;
	top: 20px;
	width: 100%;
	overflow: visible;
}
.box2 {
	position: relative;
	width: 100%;
	height: 100%;
	background-color: #fff;
	-webkit-box-shadow: 0 1px 5px rgba(0,0,0,0.25);
	box-shadow: 0 1px 5px rgba(0,0,0,0.25);
}
.box2:before {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px / 100px;
    z-index: -1;
    top: -5px;
    content: "";
    box-shadow: 0 0 26px rgba(0,0,0,0.51);
}
 
.tabs {
	position: relative;
	width: 100%;
	top: -30px;
	height: auto;
	min-height: 200px;
	margin:0; 
}
 
.tabs input {
	position: absolute;
	z-index: 10;
	width: 120px;
	height: 40px;
	right: 120px;
	top: 0px;
	opacity: 0;
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    filter: alpha(opacity=0);
	cursor: pointer;
}
.tabs input#tab-2{
	right: 0px;
}
 
 
.tabs label {
	background: rgb(85,85,85);
	font-family: 'confortaa-light';
	font-size: 14px;
	line-height: 30px;
	height: 30px;
	position: relative;
	padding: 0 20px;
    float: right;
	display: block;
	width: 80px;
	color: #FFF;
	text-align: center;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.3);
    box-shadow: 2px 0 2px rgba(0,0,0,0.1), -2px 0 2px rgba(0,0,0,0.1);
}
 
.tabs label:after {
    content: '';
	position: absolute;
	bottom: 0px;
	left: 0;
	width: 100%;
	height: 2px;
	display: block;
}
 
.tabs input:hover + label {
	background: #979797;
}
 
.tabs label:first-of-type {
    z-index: 4;
    box-shadow: 2px 0 2px rgba(0,0,0,0.1);
}
 
.tab-label-2 {
    z-index: 3;
}
 
.tab-label-3 {
    z-index: 2;
}
 
.tab-label-4 {
    z-index: 1;
}
 
.tabs input:checked + label {
    background: rgb(97,205,245);
	z-index: 6;
 
}
 
.clear-shadow {
	clear: both;
}
 
.content {
	background: #fff;
	position: relative;
	width: 100%;
	z-index: 5;
	overflow: visible;
	border-radius: 0 3px 3px 3px;
 
}
 
.content div {
    position: absolute;
	top: 0;
	padding-top: 20px;
	padding-bottom: 20px;
	padding-left: 70px;
	padding-right: 70px;
	z-index: 1;
    opacity: 0;
    -webkit-transition: all linear 0.3s;
    -moz-transition: all linear 0.3s;
    -o-transition: all linear 0.3s;
    -ms-transition: all linear 0.3s;
    transition: all linear 0.3s;
}
 
.content-1, .content-3 {
	-webkit-transform: translateX(-250px);
	-moz-transform: translateX(-250px);
	-o-transform: translateX(-250px);
	-ms-transform: translateX(-250px);
	transform: translateX(-250px);
}
 
.content-2, .content-4 {
    -webkit-transform: translateX(250px);
	-moz-transform: translateX(250px);
	-o-transform: translateX(250px);
	-ms-transform: translateX(250px);
	transform: translateX(250px);
}
 
.tabs input.tab-selector-1:checked ~ .content .content-1,
.tabs input.tab-selector-2:checked ~ .content .content-2,
.tabs input.tab-selector-3:checked ~ .content .content-3,
.tabs input.tab-selector-4:checked ~ .content .content-4 {
	font-family: 'confortaa-light';
	font-size: 14px;
    -webkit-transform: translateX(0px);
	-moz-transform: translateX(0px);
	-o-transform: translateX(0px);
	-ms-transform: translateX(0px);
	transform: translateX(0px);
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
    filter: alpha(opacity=100);
    opacity: 1;
    -webkit-transition: all ease-out 0.2s 0.1s;
    -moz-transition: all ease-out 0.2s 0.1s;
    -o-transition: all ease-out 0.2s 0.1s;
    -ms-transition: all ease-out 0.2s 0.1s;
    transition: all ease-out 0.2s 0.1s;
}
 
.content div h2,
.content div h3{
	font-family: 'confortaa-light';
	font-size: 20px;
	color: rgb(85,85,85);
}
.content div p {
	font-family: 'confortaa-light';
	font-size: 16px;
	line-height: 22px;
	font-style: italic;
	text-align: left;
	margin: 0;
	color: #777;
	padding-left: 15px;
	font-family: confortaa-light;
	border-left: 8px solid rgba(63,148,148, 0.1);
	font-weight: lighter;
}