Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to float a top bar?

Tags:

html

css

scroll

I want to find a drupal theme that has a bar like Twitter's top bar at http://dev.twitter.com that stays there. If there is not one, how do I replicate that similar effect in a Drupal 7?

like image 356
Rolando Avatar asked Dec 03 '22 00:12

Rolando


2 Answers

While I don't know of any Drupal themes, I know how to recreate the effect -- to pin an element to the top of the viewport, use CSS's position: fixed:

#topbar {
    position: fixed;
    top: 0
}

You'll also probably want to put a top margin on the rest of your content, so that it doesn't cover it up.

like image 50
Christian Mann Avatar answered Jan 18 '23 15:01

Christian Mann


You can also check out Twitter's excellent Bootstrap project for examples. See here for the details. They call it a top bar. Also you could use Bootstrap as a starting point for a Drupal custom theme if you want to roll your own.

like image 39
SnapShot Avatar answered Jan 18 '23 16:01

SnapShot