webForumDet fria alternativet

centrera swf fil

1 svar · 340 visningar · startad av rille31

rille31Medlem sedan okt. 2004186 inlägg
#1

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>
BlixtsystemsMedlem sedan maj 2005704 inlägg
#2

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.

155 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
152 ms — hämta tråd, inlägg och bilagor (db)