I find myself facing an unexpected challenge with whitespace appearing mysteriously within a list of dropdown items that I have created. Visually, it presents as follows:
https://i.sstatic.net/olLDA.png
The HTML code causing the issue (using bootstrap 4.3.1) is shown below:
<div class="container">
<div class="row">
<div class="col">
<center>Test Column</center>
<div class="dropdown">
<li><a href="#">Test text 1<span>✓</span></a> </li><br>
<a href="#">
<div class="dropdown-content">
<p>Dropdown item 1</p>
</div>
</a>
</div>
<div class="dropdown">
<li><a href="#">Test text 2<span>✓</span></a> </li><br>
<a href="#">
<div class="dropdown-content">
<p>Dropdown item 2</p>
</div>
</a>
</div>
</div>
</div>
</div>
The CSS relevant to this issue is outlined below:
/* Ensure each list item appears on a separate line */
ul {
display: inline;
}
/* Styling for visited links */
a span {
color: white;
}
a:hover {
text-decoration: none;
}
a:visited span {
color: green;
}
/* Dropdown Menu */
.dropdown {
position: relative;
display: block;
}
.dropdown-content {
display: none;
position: absolute;
overflow: hidden;
background-color: #f9f9f9;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
left: 20%;
}
.text-window {
min-width: 320px;
min-height: 480px;
}
.dropdown:hover .dropdown-content {
display: inline-block;
}
The issue has also been replicated in this JSFiddle.