i am new to css and html. so my ul li dropdown menu and log in both have background, red and blue boxes that have gaps within the div and i want them to fit it with the height of the div.
here is the code:
@keyframes animation {
from {opacity: 0%;}
to {opacity: 100%;}
}
.maindiv{
width: 100%;
height: 30px;
background-color: black;
}
.ul1{
height: 30px;
margin: 0px;
padding: 0px;
text-align: right;
list-style-type: none;
color: white;
}
.ul1 a{
color: white;
text-decoration: none;
}
body{
animation-name: animation;
animation-duration: 2s;
font-family: Arial, sans-serif;
}
li{
display: inline;
width: 100%;
height: 100%;
margin-right: 100px;
text-align: left;
}
.dropdown{
display: none;
position: absolute;
margin-left: 70%;
color: black;
}
.more:hover .dropdown{
display: block;
}
#table{
height: 100px;
width: 200px;
margin-top: 10px;
box-shadow: 0px 5px 5px gray;
}
.more{
width: 200px;
background-color: blue;
}
.more td:hover{
border: 1px solid black;
}
#li5{
font-weight: bold;
background-color: red;
margin-left: 20px;
}
h1{
font-style: italic;
color: blue;
font-size: 50px;
text-shadow: 0px 12px yellowgreen, 0px 19px red;
}
<h1>Retro Logo</h1>
<div class="maindiv">
<ul class="ul1">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li class="more"><a href="#">More +</a>
<div class="dropdown"><table id="table">
<tr><td>option 1</td>
<td>option 2</td>
</tr>
<tr><td> option 3</td>
<td>option 4</td>
</tr>
</table></div></li>
<li id="li5"><a href="#">Log in</a></li>
</ul>
</div>
i tried everything like changing margin and padding to 0 but nothing worked. thanks in advance :))
4
Answers
In the CSS, try to delete the
height
property from.maindiv
and.ul1
.If your question is to list your drop downs evenly:
If your question is to set the space between your container divs then you should:
Hope this helps!
I changed your
li
rule toAnd it works. See:
I know you want a drop down button, so dont get it too complicated you can use this as a drop down one, basically these are more modern samples instead of yours not so modern ones!
now if you want the full navigation bar i do recommend you to use this!