-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBorderBoxWithLinksToTop.html
More file actions
115 lines (114 loc) · 3.91 KB
/
BorderBoxWithLinksToTop.html
File metadata and controls
115 lines (114 loc) · 3.91 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
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
<!DOCTYPE html>
<html>
<head>
<title>Link To Top</title>
<style type="text/css">
#container {
margin-right: auto;
margin-left: auto;
width: 960px;
padding: 10px;
border-radius: 10px;
font-size: 0;
}
.box {
display: block;
background-color: #81BBC9;
border-radius: 10px;
font-size: 16px;
text-align: center;
padding: 30px 0;
margin: .25%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#sidebar {
display: inline-block;
width: 30%;
padding-left: 40px;
padding-right: 40px;
position: relative;
}
#content {
display: inline-block;
width: 69%;
padding-left: 40px;
padding-right: 40px;
height: 100%;
float: right;
position: relative;
}
p {
padding-bottom: 50px;
margin-bottom: 50px;
text-align: left;
}
#linkToTop {
position: absolute;
bottom: 0px;
right: 0px;
}
#sideLinkToTop {
position: absolute;
bottom: 0px;
left: 0px;
}
</style>
<script type="text/javascript">
function getHeight()
{
var sidebar = document.getElementById('sidebar');
var content = document.getElementById('content')
var compStyle = window.getComputedStyle(sidebar, null);
var sidebarHeight = compStyle.height;
compStyle = window.getComputedStyle(content, null);
var contentHeight = compStyle.height;
if(sidebarHeight>contentHeight)
{
document.getElementById('content').style.height=sidebarHeight;
}
else
{
document.getElementById('sidebar').style.height=contentHeight;
}
}
</script>
</head>
<body onload="getHeight()">
<div id="container">
<div class="box"><h1>Header</h1></div>
<div class="box" id="sidebar"><h2>Sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<a href="#sidebar"><img id="sideLinkToTop" src="images/arrow.png" width="80px" height="80px" alt="Side link-to-top"></a>
</div>
<div class="box" id="content"><h2>Content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<a href="#content"><img id="linkToTop" src="images/arrow.png" width="80px" height="80px" alt="link-to-top"></a>
</div>
<div class="box"><h2>Footer</h2></div>
</div>
</body>
</html>