Development Center text in page code?

Discussion in 'Software' started by A3D, 17 Aug 2006.

  1. A3D

    A3D What's a Dremel?

    Joined:
    14 Oct 2005
    Posts:
    456
    Likes Received:
    0
    Ok on my forum i am trying to center a header image at the top but it always goes to the left side of the page, is there a code i can make that will center it?
     
  2. Ramble

    Ramble Ginger Nut

    Joined:
    5 Dec 2005
    Posts:
    5,596
    Likes Received:
    43
    How are you trying to centre it?
     
  3. mcg1sean

    mcg1sean What's a Dremel?

    Joined:
    5 Apr 2006
    Posts:
    56
    Likes Received:
    0
    try putting <div align="center"> before your picture. just make sure to close the above tag with a </div> after your picture. try that, or use CSS to make your layout and use something like the code below for your header:

    Code:
    #header {
      margin: 20px;
      padding: 10px;
      height: 100px;
      background-image: url(*your picture*.gif, jpg, png)
     
  4. will.

    will. A motorbike of jealousy!

    Joined:
    2 Mar 2005
    Posts:
    4,461
    Likes Received:
    20

    bad way ^^^
    good way \/\/\/

    Code:
    #header {
      width:600px /*Or whatever you want*/
      height: 100px;
      margin:auto; /*centers the div*/
      background: url(*your picture*.gif, jpg, png) top center no-repeat; /*centers the background image to the top*/
    }
     
  5. A3D

    A3D What's a Dremel?

    Joined:
    14 Oct 2005
    Posts:
    456
    Likes Received:
    0
    Ok thanks alot guys, So can i actually resize this banner by just that code you show will, instead of bringing it back into photoshop to resize everytime?
     
  6. eek

    eek CAMRA ***.

    Joined:
    23 Jan 2002
    Posts:
    1,600
    Likes Received:
    14
    Not AFAIK :)

    If your host has the GD lib working then you could always resize it using that!

    Alternatively, to allow it to be resized you could just create an img element with a z-index lower than the text with the dimensions you require.
     
  7. will.

    will. A motorbike of jealousy!

    Joined:
    2 Mar 2005
    Posts:
    4,461
    Likes Received:
    20
    I thought you meant that you wanted the image center, not that it would stretch to fit.... Tbh, stretching an image in a browser looses the quality vber badly.
     

Share This Page