html – What is the simplest (least amount of code) way to vertically and horizontally align an embed?-ThrowExceptions

Exception or error:

I need a simple and efficient way to take an <embed> tag (containing a flash game) and center it both vertically and horizontally inside of a <body> tag to keep the amount of code down without complicating the page with extra <div> tags or tables.

From what I’ve found online, the simplest way to do this is to use an inline style sheet like so:

<html>
    <head>
        <title>Game</title>
    </head>
    <body>
        <embed src="game.swf" quality="high" width="800" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto;">
    </body>
</html>

Are there any simpler ways to center this embed? Even moving all the elements outside of the inline style sheet and into the embed directly would be an improvement.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *