-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathes_mediaquery-breakpoint.html
262 lines (236 loc) · 7.41 KB
/
es_mediaquery-breakpoint.html
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Es Flexbox</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');
/*font-family: "Ubuntu", sans-serif;*/
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
background-color:white ;
}
#logo{
font-family: "Ubuntu", sans-serif;
font-weight: 700;
font-size: 36px;
color: darkmagenta;
}
#main-header{
background-color: whitesmoke;
padding: 5px;
display: flex;
height: 60px;
flex-direction: row; /*mette gli elementi in riga da sinistra a destra, valore impostato di default quando si dichiara display flex su un contenitore*/
/*flex-direction: column; mette gli elementi in colonna dall'alto verso il basso*/
/*flex-direction: column-reverse; mette gli elementi in colonna dal basso verso l'alto*/
/*flex-direction: row-reverse; mette gli elementi in riga da destra a sinistra*/
justify-content: space-between; /*allineamento e distribuzione dello spazio del contenitore flessibile sull'asse orizzontale*/
/* justify-content: space-around; imposta uno spazio predefinito a destra e sinistra degli elementi*/
/* justify-content: space-evenly; imposta uno spazio predefinito uguale tra tutti gli elementi*/
align-items: center; /*allineamento e distribuzione dello spazio del contenitore flessibile sull'asse verticale, se il contenitore non ha una altezza (height) impostata, l'allineamento verrà fatto in basel all'elemento con altezza maggiore*/
}
/* #menu-desktop{
display: none;
} */
#menu-desktop ul{
display: flex;
list-style-type: none;
}
#menu-desktop ul li a{
color: darkmagenta;
font-size: 16px;
text-transform: uppercase;
text-decoration: none;
font-family: "Ubuntu", sans-serif;
font-weight: 600;
padding: 0 8px;
}
#ham{
width: 30px;
height: 30px;
position: relative;
margin-top: 10px;
}
#ham span{
position: absolute;
width: 100%;
height: 1px;
background-color: darkmagenta;
top: 0;
left: 0;
transition: all 0.5s;
}
#ham span:nth-of-type(2){
top: 10px;
}
#ham span:nth-of-type(3){
top: 20px;
}
.contenitoreFlex{
display: flex;
background-color: thistle;
flex-wrap: nowrap;
}
#ham.open span:nth-of-type(1){
transform: rotate(45deg);
top:-1px;
}
#ham.open span:nth-of-type(2){
display: none;
opacity: 0;
}
#ham.open span:nth-of-type(3){
transform: rotate(-45deg);
top: -1px;
}
#ham.open{
margin-top: 30px;
padding: 10px;
}
.contenitoreFlex div{
width: 250px;
height: 150px;
background-color: darkcyan;
margin: 10px;
border: 2px solid darkmagenta;
color: white;
text-align: center;
line-height: 150px;
}
.contenitoreFlexWrap{
display: flex;
background-color: thistle;
flex-wrap: wrap;
}
.contenitoreFlexWrap div{
width: 250px;
height: 150px;
background-color: darkcyan;
border: 2px solid darkmagenta;
color: white;
text-align: center;
line-height: 150px;
}
.contenitoreFlexAlignStretch{
height: 300px;
display: flex;
background-color: thistle;
align-items: stretch;
}
.contenitoreFlexAlignStretch div{
width: 150px;
background-color: darkcyan;
border: 2px solid darkmagenta;
margin: 10px;
color: white;
text-align: center;
line-height: 150px;
}
#wrapperMenuMobile{
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding:30px;
}
#wrapperMenuMobile nav ul{
list-style: none;
}
#wrapperMenuMobile nav ul li a{
font-family: 'Ubuntu',sans-serif;
text-transform: uppercase;
font-size: 24px;
font-weight: 700;
line-height: 40px;
color: darkmagenta;
text-decoration: none;
}
/*utilizzare sempre il min-width durante media-query per realizzarlo in mobile */
/* mediaquery bootstrap */
@media screen and (min-width:576px) {
#menu-desktop ul{
display: none;
}
}
@media screen and (min-width:768px) {
#menu-desktop ul{
display: flex;
}
#ham{
display: none;
}
}
@media screen and (min-width:992px) {
#menu-desktop ul{
display: flex;
}
}
@media screen and (min-width:1200px) {
#menu-desktop ul{
display: flex;
}
}
@media screen and (min-width:1440px) {
#menu-desktop ul{
display: flex;
}
}
</style>
</head>
<body>
<header id="main-header">
<div id="logo">
M&D
</div>
<nav id="menu-desktop">
<ul>
<li> <a href="#">Home</a></li>
<li> <a href="#">About</a></li>
<li> <a href="#">Portfolio</a></li>
<li> <a href="#">Contact</a></li>
</ul>
</nav>
<div id="ham">
<span></span>
<span></span>
<span></span>
</div>
<div id="menuMobile">
<div id="wrapperMenuMobile">
<nav>
<ul>
<li> <a href="#">Home</a></li>
<li> <a href="#">About</a></li>
<li> <a href="#">Portfolio</a></li>
<li> <a href="#">Contact</a></li>
</ul>
</nav>
</div>
</div>
</header>
<main>
</main>
<script>
const ham=document.querySelector('#ham');
const menuMob=document.querySelector('#menuMobile');
//console.log(ham);
ham.addEventListener('click',function(){
if(this.classList.contains('open')){
// console.log('ciao');
this.classList.remove('open');
menuMob.style.left="-100%";
}else{
this.classList.add('open');
menuMob.style.left="0";
}
});
</script>
</body>
</html>