html - 主图像出现在中心

标签 html css

我正在处理这个页面: http://tinyurl.com/ok9wzro

主图像(建筑物)向左侧移动。我希望它与下面的内容很好地对齐(居中)。 我希望它在所有屏幕尺寸上看起来都相似。

如有任何帮助,我们将不胜感激。

谢谢..

抱歉链接,它只在我们的内部网上运行。这是我的代码:

 <header style="background-image:none; background-size: none;background-color:#fff; height:410px;border-bottom:none" >
    <div style="width: 76%; margin: auto;">
        <div style="float: left; width: 8.5%;"></div>
        <div style="float: left; width: 83%; display: table;margin: 0 auto;">
            <img src="http://abcde.com/images/image.jpg" style="display: block; margin-left: auto;margin-right: auto" width="" />   
            <div class="outer-wrapper" style="padding:6% 1% 1% 18%; position:absolute">
                     <div class="title" style="min-height: 0px; width: 66.15254%; position:absolute;margin-left:0px">
                        <hgroup>
                          % if homepage_overlay_html:
                            ${homepage_overlay_html}
                          % else:
                            % if self.stanford_theme_enabled():
                              <h1>${_("Free courses from <strong>{university_name}</strong>").format(university_name="VU")}</h1>
                            % else:
                              <h2>${_("Some text here")}</h2>
                            % endif
                              <h2>${_("For anyone, anywhere, anytime")}</h2>
                          % endif
                        </hgroup>
                  </div>
                </div>
        </div>
        <div style="float: left; width: 8.5%;"></div>
        <br style="clear: left;" />
    </div>
  </header>

最佳答案

不知道你的脚本是什么.. 我在下面假设和解决方案。希望对您有所帮助...

#imgeId
{
background:url(imagePath) no-repeat center center;
height:200px;
width:200px;
}

img{
    position: absolute;
    margin: auto;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

关于html - 主图像出现在中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26924207/

相关文章:

css - 在 Visual Studio Code 的 CSS 文件中启用供应商前缀自动完成

javascript - Angularjs slider 选择日期而不是数字

javascript - 平面中的文本不会在 A-Frame PWA 中离线显示

javascript - Firefox 后退按钮仅在第一次有效,第二次无效

css - 不同大小 Bootstrap 的输入

javascript - 为我的特定代码编写正则表达式

javascript - 我试图让这个脚本函数处理图像加载

java - 在 Play Framework 中将字符串转换为 Html

css - fieldset firefox 溢出 CSS 修复

javascript - 带有选择框选项的 onMouseOut 事件问题 (IE)