Center a image in Dreamweaver2004

Discussion in 'Design and Graphics' started by azula, Jan 27, 2008.

  1. azula macrumors newbie

    Joined:
    Jan 27, 2008
    #1
    Helo,

    I need help (using Dreamweaver2004) to center an image or a .swf file right in the midle of browser window, so that it keeps in center wen resising the window.

    I only know how to center whith text aligment( you know left;center;riight):eek:

    best regards,
    Alex
     
  2. digitalField macrumors regular

    Joined:
    May 21, 2004
    Location:
    portland
    #2
    So are you looking for vertical alignment as well ?
    If so. one way to do it is with CSS. the other way is with nested tables.

    Since i am a fan of CSS over tables, here is a link to an example.
    http://www.infinitywebdesign.com/research/cssverticalcentereddiv.htm
    Just view the source to see what CSS he is applying to it and what the code looks like.

    M!
     
  3. azula thread starter macrumors newbie

    Joined:
    Jan 27, 2008
    #3
    Great Mike:)

    Its exactly that !
    Unfortunately I cant discern what part of the code I can use...perhaps you could help me...thx
     
  4. digitalField macrumors regular

    Joined:
    May 21, 2004
    Location:
    portland
    #4
    there are two things that you will need to do.

    1. wrap your embed/object tag with a div.
    1.a. give that div a unique 'id'

    2. add the following css styling to your page
    Code:
    #mydiv {
    	position:absolute;
    	top: 50%;
    	left: 50%;
    	width:30em;
    	height:18em;
    	margin-top: -9em; /*set to a negative number 1/2 of your height*/
    	margin-left: -15em; /*set to a negative number 1/2 of your width*/
    	border: 1px solid #ccc;
    	background-color: #f3f3f3;
    }
    where it says #mydiv substitute 'mydiv' with whatever you named your id

    hopefully that helps!

    M!
     
  5. azula thread starter macrumors newbie

    Joined:
    Jan 27, 2008
    #5
    Thanks again, its nice from you to help,

    I need a bit more help please, how to : 1. wrap your embed/object tag with a div.
    the rest I think I can handle...


    thx for your patience:)
     
  6. azula thread starter macrumors newbie

    Joined:
    Jan 27, 2008
    #6
    I gave a look in Dreamweaver tuturials and I think I already know how to tag a object...
    Please follow this steps to see if im right:
    1.Select the object(to be highlited in code view)
    2.then ctrl+click the highlited code and choose "insert Tag"
    3. HTML Tag>Formating and Layout>general>div
    5. Insert

    I gave the ID as you told me

    the problem now is were apply the code you gave me

    Iwant to apply it in this work:
    (This is a .swf file centered whith text align)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>barco</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF">
    <div align="center">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="453" height="513">
    <param name="movie" value="barco.swf">
    <param name="quality" value="high">
    <embed src="barco.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="453" height="513"></embed></object>
    </div>
    </body>
    </html>


    thx for everything
     
  7. azula thread starter macrumors newbie

    Joined:
    Jan 27, 2008
    #7
    victory

    hi,

    Finaly, I made it !!
    It was obvious that I would have to change the W: H: settings (in the code) to my W: H:
    But it was not all, after a few attempts I notested the mairgin values that were half of W H... et voilá !!

    sorry the bad english, Im Portuguese

    thx a lot:)
     

Share This Page