私は Web 開発に比較的慣れていません。私の学校から、学校の Web ショーをホストする Web ページを作成するように依頼されました。埋め込まれたビデオを中央に配置するのに問題があります。
margin-left: auto; margin-right: auto;
埋め込みコードにインライン スタイルを追加しようとしましたが、中央揃えになりません。余白は手動で変更できますが、誰かがページにアクセスするたびにビデオを自動的に中央に配置したいと考えています。
自動マージンは埋め込みタグでサポートされていませんか?
<!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">
<head>
<link rel="stylesheet" type="text/css" href="SDL.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Home</title>
</head>
<body>
<div style="background-image:url(img/Stage-Background.png)"; margin-top:100px; margin-bottom: 100px;>
<embed
src="http://blip.tv/play/AwGUv2w"
type="application/x-shockwave-flash" width="669"
height="500" allowscriptaccess="always"
allowfullscreen="true" style="margin-left:auto; margin-right:auto;"></embed>
</div>
</body>
</html>
少なくとも Chrome では、マージン スタイルが無視されていることを示す簡単な例:
/* does not center it: */
embed { margin: 0 auto; }
div, embed { border: 1px solid black; }
div { width: 100%; }
<div>
<embed src="https://cdn.sstatic.net/stackexchange/Img/se-logo.png">
</div>
次のようにレンダリングされる Windows Chrome の場合: