-
Notifications
You must be signed in to change notification settings - Fork 0
/
Css layout debuger.html
67 lines (59 loc) · 2.04 KB
/
Css layout debuger.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
<!DOCTYPE html>
<html>
<head>
<title>Css layout debuger</title>
<link rel="stylesheet" type="text/css" href="./CSS/home.css">
<style></style>
</head>
<body>
<H1>Css layout debuger</H1>
<div id="container"></div>
<div id="footer">
<h3> Document Information </h3>
<ul>
<li>
Date: 2015/02/04
</li>
<li>
Reference:
<ul>
<li><a target="_blank" href="https://gist.github.com/addyosmani/fd3999ea7fce242756b1">CSS layout debugger</a></li>
<li><a target="_blank" href="http://ourjs.com/detail/54be0a98232227083e000012">learn from css debuger</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
<script src="./LIB/jquery/jquery-2.1.3.js"></script>
<script src="./LIB/google-code-prettify/src/run_prettify.js"></script>
<script src="./LIB/home.js"></script>
<script type="text/javascript">
/* Css layout debugger
A tweet-sized debugger for visualizing your CSS layouts.
Outlines every DOM element on your page a random (valid) CSS hex color. */
$(window).load(function(){
[].forEach.call(
//Query all the elements
document.querySelectorAll("*"),
function(a){
//Pick a valid random css hex color and convert to a base 16 number for outline
a.style.outline="1px solid #"+ (~~(Math.random()*(1<<24))) .toString(16);
});
});
/* We can use toString to convert decimal to hexadecimal */
(function(){
var a = 12.34,
b = -1231.24122,
c = 2323.000001;
console.log(~~a);
console.log(~~b);
console.log(~~c);
console.log(~~a == parseInt(a, 10));
console.log(~~b == parseInt(b, 10));
console.log(~~c == parseInt(c, 10));
console.log(~~a == 0|a == parseInt(a, 10));
console.log(~~b == 0|b == parseInt(b, 10));
console.log(~~c == 0|c == parseInt(c, 10));
}());
</script>