---
title: "centrera swf fil"
type: "forum-thread"
url: "https://www.webforum.nu/amne/html-css/149196-centrera-swf-fil"
topic: "HTML & CSS"
topic_url: "https://www.webforum.nu/amne/html-css"
author: "rille31"
published: "2006-07-18T20:05:02.000Z"
updated: "2006-07-18T22:43:04.000Z"
replies: 1
views: 352
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/html-css/149196-centrera-swf-fil"
---

# centrera swf fil

## #1 — rille31, 2006-07-18T20:05Z

Någon som kan hjälpa mig att centrera en swf fil till mitten på sidan. File skrivs ut i diven flashcontent.

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Pierce - test</title>
<script type="text/javascript" src="swfobject.js"></script>
<style type="text/css">
html {
/* hide from ie on mac \*/
 
}
 
#flashcontent {
position: relative;
align: center;
margin: auto;
width: 880px;
height: 410px;
}
/* end hide */
body {
background-color: #C2C2C2;
font-family: Arial, Verdana, sans-serif
font-size: 10px;
}
p{
font-size: 12px;
color: #000000;
}
#content {
margin-left: 100px;
margin-top: 100px;
width: 505px;
}
a{
color: #990000;
}
a:link {
color: #990000;
text-decoration: underline;
}
a:hover {
color: #FF0000;
}
</style>
</head>
<body>
<div id="flashcontent" align="center">
<div id="content"><p>Please turn on javascript in your browser settings and check if you have atleast flashplayer
7 installed on your computer.</br>Download the latest flashplayer for free from <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">www.adobe.com</a></p>
</div></div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("pierce.swf", "pierce","880", "410", "7", "#C2C2C2");
so.addParam("scale", "noscale");
so.write("flashcontent"); 
// ]]>
</script>
</body>
</html>
```

Permalänk: https://www.webforum.nu/p/149196

## #2 — Blixtsystems, 2006-07-18T22:43Z

För att centrera både vertikalt och horizontellt brukar jag köra med något typ detta:

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css" media="screen"><!--
 /* styles for IE 5 Mac */
 #horizon {
	background-color: transparent;
	position: absolute;
	top: 20px;
	left: 20px;
 }
 
 /* following rules are invisible to IE 5 \*/
 #horizon {
   top: 50%;
   left: 0px;
   width: 100%;
   margin-top: -225px;
   text-align: center;
   min-width: 660px; 
 }
 /* end IE 5 hack */ 
	  
#wrapper {
	background-color: #000000;
	position: relative;
	text-align: center;
	width: 660px;
	height: 450px;
	margin: 0px auto;
}
--></style>
</head>
<body>
<div id="horizon">
<div id="wrapper">

// ditt centrerade innehåll

</div>
</div>
</body>
</html>
```

Exemplet är för en swf med storleken 660x450 så du får byta ut width, height och min-width för att passa till din swf samt sätta margin-top till halva höjden.

Permalänk: https://www.webforum.nu/p/1843168

---

Tråden på webben: https://www.webforum.nu/amne/html-css/149196-centrera-swf-fil
