473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to keep my navigation bar stick to the top?

Im trying to get my nagivation bar to stick to the top of the page but cant for some reason. I tried looking up and i tried a few things but they didnt work.

Expand|Select|Wrap|Line Numbers
  1. body {background-color:black;}
  2.      ul {
  3.      list-style-type: none;
  4.      margin: -8;
  5.      padding-bottom: 0px;
  6.      padding-top: 0px;
  7.      overflow:hidden;
  8.      background-color:rgb(235,0,0);
  9.      margin-top: 5px;
  10.      font-family: ariel;
  11.      }
  12.     li {
  13.      padding-left: 35%;
  14.     }
  15.     li a {
  16.     display: inline;
  17.     float: left;
  18.     text-decoration: none;
  19.     padding-left: 25px;
  20.     padding-top: 20px;
  21.     padding-right: 25px;
  22.     padding-bottom: 20px;
  23.     }
  24.     li a:link{
  25.     color:white;
  26.     text-decoration: none;
  27.     }
  28.     li a:visited{
  29.     color:purple;
  30.     text-decoration: none;
  31.     }
  32.     li a:hover{
  33.     background-color:rgb(200,0,0);
  34.     text-decoration: none;
  35.     margin: auto;
  36.     }
  37.     li a:active{
  38.     color:rgb(100,100,100);
  39.     text-decoration: none;
  40.     }
As you can see i use ul,li and a href tags to make the nav bar and to get it in a horizontal form i use float: left Thanks!
Oct 9 '17 #1

✓ answered by Exequiel

just put this to your css in ul
Expand|Select|Wrap|Line Numbers
  1. position: fixed;

2 32603
Exequiel
288 256MB
just put this to your css in ul
Expand|Select|Wrap|Line Numbers
  1. position: fixed;
Oct 10 '17 #2
Hey, thanks a lot for help :)
Oct 16 '17 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: danny van elsen | last post by:
hello all, I have an application in which I build a list<node>, with potentially thousands of nodes. each node has an "index", and all nodes are ordered by this index. this index reflects a...
12
by: TP | last post by:
Here is my problem. I need to display a table about which I have no information except the table name. Using metadata I can somehow show the column names and record values. But my table has 1...
1
by: Robert Neville | last post by:
I am having some trouble with some old code revolving around custom form navigation buttons. My main form has a sub-form with these custom navigation buttons. In other words, the code should be...
1
by: Simon | last post by:
Hello, Please sorry my poor English. I have 3 aspx webforms. Each page has 2 hyperlinks objets to go on the other pages. In all the webforms, there are textbox, ddlists, button and a datagrid....
28
by: laredotornado | last post by:
Hi, Surprisingly, I can't get the drop down menus to work on PC IE 6. If you roll over "PRODUCTS", normally a drop down menu appears (on Safari and Firefox), but on PC IE, nada. ...
4
by: Jamey Shuemaker | last post by:
Howdy, Saw a couple threads from the past few years on this topic, but didn't really find any solutions. Here's one I found:...
4
by: robert.waters | last post by:
Hello, I have a main form that is maximized when my application loads; this main form contains links to all other forms. I've had to specify the Popup property of these other forms, so that...
5
RMWChaos
by: RMWChaos | last post by:
Apparently, I can't do anything the easy way, which seems to lead me here so very, very often. Here is what I am trying to do this time: 1. Autogenerate two navigation bars, "navLeft" and...
0
by: empiresolutions | last post by:
http://sb.cesarvillaca.com/footer-bug.html (code at the bottom) I have been trying like crazy to get the positioning of this nav correct. I need to get each of the navs to position exactly over...
5
Seth Schrock
by: Seth Schrock | last post by:
I have created a navigation form in Access 2010 using the horizontal tabs, 2 levels style. This form is my startup form. In the top row, I have to options. Under each option are several sub-tabs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.