Javascript 在网页中央标题栏下居中放置谷歌地图

Javascript 在网页中央标题栏下居中放置谷歌地图,javascript,css,html,aptana,Javascript,Css,Html,Aptana,我试图将我的谷歌地图居中,但它不想从左对齐移动。每当我试图修改它时,它就会删除我的标题 我的css代码 #mapCanvas { width: 960px; height: 150px; margin-left: auto; margin-right: auto; } header { width: 960px; height: 150px; margin-left: auto; margin-right: auto; b

我试图将我的谷歌地图居中,但它不想从左对齐移动。每当我试图修改它时,它就会删除我的标题

我的css代码

#mapCanvas {
    width: 960px;
    height: 150px;
    margin-left: auto;
    margin-right: auto;
}

header {
    width: 960px;
    height: 150px;
    margin-left: auto;
    margin-right: auto;
    background-color: #339966;
    font-family: Garamond;
    font-weight: bold;
    font-style: italic; 
}

h1{ 
    color: white;
    font-family: Garamond;
    font-weight: normal;
    font-style: italic;
    text-align: center;
    font-size: 40px
}
p {
    color: white;
    font-family: Garamond;
    font-weight: normal;
    font-style: italic; 
    text-align: center;
    font-size: 20px;
}
我的html中的代码

<body>
    <header> 
        <h1>
            Find a user's location using HTML5 Geolocation
        </h1> 
        <p> If Geolocation sercive is failed, the University of Maryland Campus will be displayed on a map</p>
        </header>

    <div id="mapCanvas">

    </div>
</body>

使用HTML5地理位置查找用户的位置

如果地理定位失败,马里兰大学校园将在地图

上显示。

[1] :[My current results][1]

位置:相对
添加到
#mapCanvas
规则中,以使左/右自动边距居中工作。

谷歌地图如何进入该分区?还有更多的代码吗?(必须有…)通过API键和给定的lat和lngwell,似乎也有自己的CSS-在浏览器工具/检查工具中检查您的右侧。似乎我很早就在html表单中定义了它。