Monday, July 9, 2007

Blogger Hacks: Top Menu Bar

I can't believe how easy this turned out to be, but this is a "hack" that you'll want to try after you've backed up your html code!!!

My husband found some coding from this site that was along the lines of what I was looking for. It turned out to be just two segments of coding that was easy to manipulate (and since I wasn't using the search feature - I'll leave that to the Blogger top bar - I was able to simplify the coding even further).

Here's what you do (this is the actual coding I just added to Studeo - it's the menu just under the photo which offers choices like "About Us" and "Book Lists"). Naturally this is set up for a certain width - 796 I believe. It may take some considerable adjusting to use it for a different width:

Add this segment of coding to the top portion of your html coding (I have mine between the "Blog Header" segment and the "Posts" segment.

/* Menu
----------------------------------------------- */

/* The outer menu bar box */
div.menuBar {
width: 793px;
height: 36px;
padding: 1px;
border: 1px solid #000000;
margin-top: 1px;
margin-bottom: 1px;
margin-left: auto; /* center horizontally */
margin-right: auto;
background-color: #b3b3b3;
}

/* The boxes that go inside the menu bar */
div.menuBarBox {
width: 110px;
height: 32px;
border: 1px solid #000000;
margin-right: 1px;
float: left;
}

div.menuBarBox a {
width: 110px;
height: 30px;
padding: 1px;
border: 1px solid white;
float: left; /* have to float to put elements next to each other */
text-align: center; /* we put the align here cause the text is inside us */
background-color: #ffffff;
}

/* The current page also has this style, which just changes the background color of the box */
div.menuBarBox a.true {
background-color: #ffffff;
}

/* The links within menu bar box */
div.menuBarBox a:link {
font-size: 18px;
text-decoration: none;
line-height: 32px; /* using this to center text vertically. Could also do so by changing padding/height of menubarbox */
}

div.menuBarBox a:visited {
font-size: 18px;
text-decoration: none;
line-height: 32px; /* using this to center text vertically. Could also do so by changing padding/height of menubarbox */
}

div.menuBarBox a:hover {
background-color: white;
color: black;
font-weight: bold;
}
This is the segment where you can adjust your colors and such.

Next, add the following segment to the bottom half of your html coding. I have mine between the "header-wrapper" segment and the "cross-col wrapper" segment. Unfortunately you have to go change all of the "<"s to "("s (same thing for the opposite direction). You'll save yourself a lot of time if you just copy and paste this segment from my source code here):
(div class='menuBar')
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/' title='Home page')Home(/a)(/div)
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/2005/05/about-us.html' title='Meet the Family')About Us(/a)(/div)
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/2007/07/our-other-sites.html' title='Our other websites and various projects')Projects(/a)(/div)
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/2005/05/oddsnends.html' title='Miscellaneous and Possibly Useful Information')Highlights(/a)(/div)
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/2005/05/book-lists.html' title='Book Lists of All Sorts')Book Lists(/a)(/div)
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/2005/05/links.html' title='Favorite Links')Links(/a)(/div)
(div class='menuBarBox')(a class='false' href='http://studeo.blogspot.com/search/label/photos%2Fdrawings' title='Photos and Drawings')Photos(/a)(/div)

(/div)
Change all the links, labels and titles as desired. Make sure you don't accidentally erase any of the quotation marks when you edit things - that'll make a real mess of things.

***

UPDATED: This is Lissa chiming in to say I was sure I had posted here about adding a top menu bar to Typepad blogs, but it turns out I only mentioned it on Bonny Glen.** Here's the link to the post where I found instructions: Jimmy the Geek's Typepad Hacks. You can only do this with a Pro level account, and you'll have to convert your design to Advanced Templates. (Which turned out to be a very simple thing to do.)

Jimmy uses vertical bars to separate the items in his menu; I changed mine to little leaves (click on Bonny Glen and you'll see what I mean) by replacing the bars with image code:

(img src="http://yourimageurl")

(Replace the parentheses with pointy brackets, and of course you have to upload the image to your Typepad Files (under Control Panel) first, in order to get the URL.)

Just make sure you backup your template before attempting any of this tinkering! I tried mine out on a test blog first.

**UPDATED AGAIN: I knew I'd posted about top menu bars on this blog! I found it buried at the bottom of this post. Aha.

7 comments:

lindafay said...

Thanks for sharing this!

Kato said...

Wow, I'm slightly embarrassed that someone dug through my template code to find that. It's a jungle. Did your husband happen to find a bunch of socks or my extra set of car keys in there? Or Dr. Livingston for that matter.

Anyway, glad it worked for you!

Mary Vitamin (Helen) said...

Studeo looks great with the menu bar!

Mary said...

Thanks you for sharing this... and as a newbie, I have a question. Can I do this with Typepad Basic? Not sure how to even go about doing it. Thanks again and have a blessed day!

Melissa Wiley said...

Mary, you can't do it in Typepad Basic--you need a Pro account to be able to edit the CSS.

I'm scratching my head this morning--I could have sworn I wrote a post here about doing a top menu bar in Typepad last month when I added one to Bonny Glen! But now I can't find that post, not even in drafts. I'll look for it and get it up.

Alicia, nice work!

Love2Learn Mom said...

Lissa - I thought you did too.

Thanks all - esp. Kato. :)

Meredith said...

OK, so I've updated my template and I'd love to do the top bar thingie, but I'm nervous to mess with the Advanced design, :( I have Pro so I could do it. I LOVE your little leaves by the way Lissa, where did you find such cute little clipart?? I'd love little bees or something "Sweetness" style, any thoughts?? Thanks for any help here!!