• i added this as a class:

    .mast {
    text-align:center;
    margin-top:0px;
    margin-bottom:0px;
    padding:0px;
    }

    and the code looked like this:

    <div id="masthead" class="mast box">
    </div>

    box is an existing class which is for the box side of the page. But this doesn’t seem to centre the image. I made the box bigger as I made the page bigger, rather than making the image bigger, I would like to simply centre the image.

    Cheers

Viewing 9 replies - 1 through 9 (of 9 total)
  • I didn’t think you could have multiple classes applying like that, so unless I miss my guess, its not seeing anything after id=”masthead”. But, it *is* a guess.

    Try putting all the information you want to apply, to #masthead in the css instead.

    Jinsan

    Your CSS code is correct. I’ve used both ID with multiple class statements.

    The main thing that I do differently is declare the width for the container DIV ‘class’ which holds the item you’re wanting to center. In your case that would be the ‘.mast’ class

    HTH

    Thread Starter jinsan

    (@jinsan)

    i’ll give it a try lumper, cheers

    edit: didn’t work – bugger

    Without seeing your page layout I can’t tell but this will probably work for you.


    .mast {
    margin: 0 auto;
    padding:0px;
    }

    the 0 tells it to have no margin on the top and bottom the auto tells it to center in the container it is isolated in.

    If class=”mast box” has any margin or padding in it just kill the style from the div tag.

    Hope this helps. if you have a url it’s be easier to help.

    David
    https://blog.davidfriedberg.com

    Rememvber – it is the image that needs to be centred. There is no CSS for it. Not here anyway.

    Since they tried text-align: already and there is no set width to the <div> the div will be what ever the size of the item inside it is, which is probably why text-align: doesn’t work. If they have a 700px wide div then the text-align: should work.

    For head graphics I set them as the background. For misc images I add a class to the image and position in the CSS.

    Since we can’t see the design or code it’s really all just guessing.

    Thread Starter jinsan

    (@jinsan)

    interesting idea root – i’ll try that sometime, I resolved it the lazy man’s way for now and it works ?? i’ll keep that tip in mind though

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘centre header image’ is closed to new replies.