Reputation: 77
So, I made a navigation bar using the HTML div
and table
elements.
.menu {
background-color: black;
color: white;
font-family: Segoe UI;
}
<div class="menu">
<table border="0" cellspacing="10">
<tr>
<td>Home</td>
<td>About</td>
<td>Login</td>
</tr>
</table>
</div>
Of course, it isn't finished right now and please don't ask why I didn't use an unordered list <ul>
instead of a table.
So, the thing is I want to fix this menu on the top of the screen. No white spaces left before the div. What is the CSS code for this?
Upvotes: 1
Views: 82
Reputation: 3797
Try by following CSS codes:
.menu {
background-color: black;
color: white;
font-family: Segoe UI;
position: fixed;
top: 0;
left: 0;
width: 100%;
}
Upvotes: 1
Reputation: 511
you can use the css attribute position : fixed;
and width : 100%
to display it over all the screen
Upvotes: 1
Reputation:
body {
margin: 0;
}
.menu {
background-color: black;
color: white;
font-family: Segoe UI;
}
<div class="menu">
<table border="0" cellspacing="10">
<tr>
<td>Home</td>
<td>About</td>
<td>Login</td>
</table>
</div>
Upvotes: 2