Center text on entire page despite gif on the left

Posted on 2006-03-21
Last Modified: 2010-04-09
In the header of my page I have a gif file left justified. Next to it is the title of the page consisting of 3 lines of text.

I want the three lines of text to the right of the image but centered on the entire page. I'm currently using a table (width 99%) and I'm getting the three lines of text centered on the enclosing cell instead if the entire page. I want the text centered on the entire page as if the image was not there.

Is there a way to do that?

Question by:adg
    LVL 16

    Accepted Solution

    You just need to add an extra cell to your table.

    Assuming your gif is called headerGif.gif and is 300W x 100H.

    Make a new gif either transparent or the color of the background of your header, 1 x 1 pixel, call it blank.gif.


    <table border='0' cellpadding='0' cellspacing='0' width='100%'>
    <td width='300'>
    <img src-'headerGif.gif' width='300' height='100'><br>
    <td width='100%' align='center'>
    <td width='300'>
    <img src='blank.gif' width='300' height='100'><br>

    That sets a left and right cell that are the same size, therefore your text will be centered in a cell that is in the center.

    LVL 3

    Author Comment

    Thanks Sam, that was exactly what I needed.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
    In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now