PDA

View Full Version : How to: Auto Center your Header Logo


Medi0cr3
01-30-2015, 02:06 PM
Greetings,

I've tried to google how you have your logo auto center across your header on the forum. There's a lot of people that have various ways. I do my own and many will have various ways to go about it. Here is the simple version.

Open your "Header" template.

Look for the last </script> tag in your code and insert after it:

<style>

#logo {
display: block;
margin-left: auto;
margin-right: auto
}
</style>


Next you will need to look for this section of code which contains your header info

<div><a name="top" href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}" class="logo-image"><img src="{vb:stylevar titleimage}"
alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" /></a></div>


I modified that a little bit to have the following. There are a few things that you can keep or get rid of if you wish. I chose to eliminate some things I really dont need as I customize my forum a lot.

<a href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}"><img id="logo" src="{vb:stylevar titleimage}"/></a>


You should now have a centered Logo Image on your forum header that scales centered as your screen size changes.

TRN
01-10-2017, 01:46 PM
That's not working for me. I'm on 4.2.3PL2. Looks like the code is slightly different from your original one.

I modified my header to contain:
<vb:if condition="$stylevar['titleimage']"><div><a name="top" href="{vb:link forumhome}".php{vb:raw session.sessionurl_q}"><img id="logo" src="/Forum2016/images/Header_logo.png" alt="The Real Nicaragua"/></a></div></vb:if>

Not sure if "logo" should match the image file name?

I'd like to have both the banner logo and the log-on navbar centered.