Hoang Lam
Hoang Lam

Reputation: 464

Format a DIV into a top-most panel bar

I'm writing some CSS. I want to create a panel bar, which is always top-most and stays at the bottom of the page, height is fixed at 50px and width is unknown. Can a normal DIV do that?

Thank you in advance.

Upvotes: 0

Views: 990

Answers (3)

Chris Sobolewski
Chris Sobolewski

Reputation: 12935

At the bottom of the WINDOW? Or the bottom of a page?

If you're looking for it to be at the bottom of your document, then you're looking for something like Sticky-Footer

If you want it at the bottom of the window and to remain while you scroll, you need Position:fixed.

Edit: If you want it to stay on the bottom of the window like the Facebook chat bar, you need this:

.bottom{
    position:fixed;
    bottom:0;
}

Upvotes: 1

ToddSmithSalter
ToddSmithSalter

Reputation: 715

A div are block elements, so inheritly are full width of their containing element. If their containing element is the body tag, and has no width restrictions set, the div should be full browser width.

div {
  position: absolute;
  bottom: 0;
  height: 50px;
  z-index: 1000; /* optional, but I set for insurance */
}

Upvotes: 0

Damon Bauer
Damon Bauer

Reputation: 2726

position:fixed; bottom:0 should do the trick.

Upvotes: 0

Related Questions