-
Notifications
You must be signed in to change notification settings - Fork 0
/
HTML-whitespace-Inline-block.html
65 lines (64 loc) · 1.49 KB
/
HTML-whitespace-Inline-block.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Remove Extra Space Between Inline-Block Elements</title>
<style>
ul {
padding: 0;
list-style: none;
}
ul li {
display: inline-block;
background: #ffa500;
padding: 5px 20px;
}
/* Third Method */
.ul3 li{
margin-right: -4px;
}
/* Fourth Method */
.ul4{
font-size:0 ;
}
.ul4 li{
font-size:1rem;
}
</style>
</head>
<body>
<h2>Normal Behavior</h2>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
<hr>
<h1>After Removing Spaces</h1>
<h2>First Method</h2>
<small><b>By using <q>comments</q> </b></small>
<ul>
<li><a href="#">Home</a></li><li><a href="#">About</a></li><li><a href="#">Contact</a></li>
</ul>
<h2>Second Method</h2>
<ul>
<li><a href="#">Home</a></li><!--
--><li><a href="#">About</a></li><!--
--><li><a href="#">Contact</a></li>
</ul>
<h2>Third Method</h2>
<small><b>By using negative <q>margin-right</q> property</b></small>
<ul class="ul3">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
<h2>Fourth Method</h2>
<small><b>By setting the "font-size" to zero</b></small>
<ul class="ul4">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</body>
</html>