-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalternativeBoxSizing.html
More file actions
42 lines (35 loc) · 1.09 KB
/
Copy pathalternativeBoxSizing.html
File metadata and controls
42 lines (35 loc) · 1.09 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Border Box</title>
<style>
/* Standard Box Model - padding and border is added as extra pixels */
.box {
border: 5px solid rebeccapurple;
background-color: lightgray;
padding: 40px;
margin: 40px;
width: 300px;
height: 150px;
}
/* Alternative Box Model - padding and border are adjusted in given values */
.alternate {
box-sizing: border-box;
width: 300px;
height: 150px;
}
/* To make size of alternative box same as standard (Add padding and border values) */
.alternate {
box-sizing: border-box;
width: 390px;
height: 240px;
}
</style>
</head>
<body>
<div class="box">I use the standard box model.</div>
<div class="box alternate">I use the alternate box model.</div>
</body>
</html>