Results 1 to 4 of 4

Thread: CSS: image alignment [resolved]

  1. #1

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Resolved CSS: image alignment [resolved]

    how do i make an image appear in the center of the page, like text-align:center does for text.
    Last edited by tr333; Feb 28th, 2005 at 03:24 AM.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: CSS: image alignment

    Code:
    .cImg
        {
        text-align:center;
        display:block;
        }
    
    
    
    <img src="mendhak.gif" class="cImg">

  3. #3
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: CSS: image alignment

    Isn't it better to use


    Code:
    .cImg{
        margin-left: auto;
        margin-right: auto;
    }

    ?

  4. #4

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: CSS: image alignment

    thanks for the help..

    works great.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width