News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Needing help with logo positioning

Started by Jeremy M., May 15, 2017, 12:35:14 PM

Previous topic - Next topic

Jeremy M.

I have several pages with logos. Some logos are smaller than others, length wise.  How can I make it to where all of my logos are centering automatically on all pages without creating a style.css sheet for each individual one.


#logo {
line-height: 160px;
height: 160px;
width: 1000px;
padding: 9px 5px 5px 5px;
position: absolute;
top: 0;

Arantor

Links to the pages in question would really help at this point.

Jeremy M.


Arantor

No worries.

In actuality it's pretty straightforward. If you have all your <img> tags inside <div id="logo">, the only CSS you actually need:

#logo {
    text-align: center;
}


Image tags by default are display: inline-block, which makes them subject to text-alignment rules and that just works for keeping them centered the whole time.

EDIT: I requested the moderators move this to the appropriate board; Graphics & Templates is for SMF issues, this topic belongs in Scripting Help.

Jeremy M.

Quote from: Arantor on May 15, 2017, 01:14:12 PM
No worries.

In actuality it's pretty straightforward. If you have all your <img> tags inside <div id="logo">, the only CSS you actually need:

#logo {
    text-align: center;
}


Image tags by default are display: inline-block, which makes them subject to text-alignment rules and that just works for keeping them centered the whole time.

EDIT: I requested the moderators move this to the appropriate board; Graphics & Templates is for SMF issues, this topic belongs in Scripting Help.

Thank You so much!  I tried that a few days ago, and it didn't work, but it seems to be working now.

Advertisement: