Category Archives: css

css positioning: relative and absolute

We were working on our menu bar and the css was killing me.  So after finally reading some stuff on the web and some experimentation I figured it out. Basically, it came down to these two rules:

Rule #1:  Absolutely positioned elements use relatively positioned elements as anchors.  If no parent relatively positioned object exists, then the <html> tag is used.  (this means it will appear in the top left if you set left: 0px and top: 0px)

Rule #2:  Relative positioned objects show up where they would if they were the default “fixed” object.  However, in order to actually display them there, you need to set display: block.  (I think mine were inline or something)

Here’s a snippet of my css code that works: